public ActionResult Save(DeliveryInfo info) { var result = info.Save(ModelState, UserID, Employee.ID); var isAjaxRequest = Request.IsAjaxRequest(); string view; object model; if (result) { view = isAjaxRequest ? Views.ListPartial : Views.List; model = DeliveryInfo.Find(UserID, Employee.ID, Employee.BussinessID, "Luu thông tin thành công"); } else { view = isAjaxRequest ? Views.SavePartial : Views.Save; model = info; } if (isAjaxRequest) { return(Json(new { result = result, html = RenderPartialViewToString(view, model), }, JsonRequestBehavior.DenyGet)); } else { return(View(view, model)); } }
public ActionResult KeyList() { var list = DeliveryInfo.Find(UserID, Employee.ID, Employee.BussinessID); return(Json(new { id = list.Data.Select(l => l.ID).ToArray(), name = list.Data.Select(l => l.Name).ToArray() }, JsonRequestBehavior.DenyGet)); }
public ActionResult Update(int id) { var model = DeliveryInfo.Get(UserID, Employee.ID, id); if (Request.IsAjaxRequest()) { return(Json(new { html = RenderPartialViewToString(Views.SavePartial, model) }, JsonRequestBehavior.AllowGet)); } return(View(Views.Save, model)); }
public ActionResult List() { var data = DeliveryInfo.Find(UserID, Employee.ID, Employee.BussinessID); if (Request.IsAjaxRequest()) { return(Json(new { html = RenderPartialViewToString(Views.ListPartial, data) }, JsonRequestBehavior.AllowGet)); } return(View(Views.List, data)); }
public ActionResult Remove(int id) { DeliveryInfo.Remove(UserID, Employee.ID, id); var model = DeliveryInfo.Find(UserID, Employee.ID, Employee.BussinessID, "Xóa thông tin thành công"); if (Request.IsAjaxRequest()) { return(Json(new { html = RenderPartialViewToString(Views.ListPartial, model) }, JsonRequestBehavior.AllowGet)); } return(View(Views.List, model)); }
public ActionResult Find(string id) { var data = DeliveryInfo.Find(UserID, Employee.ID, Employee.BussinessID, "", new DeliveryFilter() { Name = id }); return(Json(new { list = data.Data.Select(e => new { ID = e.ID, Name = e.Name }).ToArray() }, JsonRequestBehavior.AllowGet)); }