简体   繁体   中英

Asp.Net Mvc redirection problem?

My story is: I have a couple of forms in separately views that post description info to edit. And every description belongs to different places. So I'm sending also refTypeId info in my forms to decide which description belongs where. So far ok. but I want to return back to edit description view where form was sent from after editing description. So I need to know where form came from that I just edited in my EditDescription action. My EditDescription action method following code:

[Authorize]
    [HttpPost]
    public ActionResult EditDescription(string descriptionToEdit, int refTypeId)
    {
        var entity = _entities.Descriptions.Where(e => e.Id == refTypeId).Select(e => e).FirstOrDefault();
        entity.Description = descriptionToEdit;
        _entities.SaveChanges();
        var Description = _entities.Descriptions.Where(e => e.Id == refTypeId).Select(e => e).FirstOrDefault();


        ViewData["Description"] = Description.Description;
        TempData["Message"]="Description has been saved";
        return (?);// i need to know which view that form was sent from 
    }

发送另一个名为ReturnUrl的参数,并在成功后重定向到该参数。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM