public JavaScriptResult Edit(WareHouseViewModel warehousevm) { try { _warehouseService.Update(Mapper.Map <Warehouse>(warehousevm)); return(JavaScript($"ShowResult('{"Data updated successfully."}','{"success"}','{"redirect"}','{"/Warehouse"}')")); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }
public ActionResult Getpage(string pagenum, string onepagecount) { WareHouseResult com = new WareHouseResult(); if (!Regex.IsMatch(pagenum, @"(?i)^[0-9a-z\u4e00-\u9fa5]+$") && !string.IsNullOrEmpty(pagenum)) { com.Msg = "页数不正确"; com.success = false; return(Json(com)); } if (!Regex.IsMatch(onepagecount, @"(?i)^[0-9a-z\u4e00-\u9fa5]+$") && !string.IsNullOrEmpty(onepagecount)) { com.Msg = "每页数量不正确"; com.success = false; return(Json(com)); } int totil = 0; int totilpage = 0; string exmsg = string.Empty; List <base_wh_warehouse> mylist = _service.GetWareHouseList(Convert.ToInt32(pagenum), Convert.ToInt32(onepagecount), out totil, out totilpage, out exmsg); if (!string.IsNullOrEmpty(exmsg)) { com.Msg = exmsg; com.success = false; return(Json(com)); } else { WareHouseViewModel mylistview = new WareHouseViewModel(); mylistview.supplist = mylist; mylistview.totil = totil.ToString(); mylistview.totilcount = totilpage.ToString(); com.DataResult = mylistview; com.success = true; return(Json(com)); } }