开发者

Asp.Net Mvc redirection problem?

开发者 https://www.devze.com 2023-01-13 12:31 出处:网络
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 deci

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).First开发者_运维知识库OrDefault();
        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 
    }


send another parameter called ReturnUrl and redirect to it on success.

0

精彩评论

暂无评论...
验证码 换一张
取 消