public ActionResult Create(int idThongTinDuTuyen) { var model = new BangCapEditViewModel(); model.IdThongTinDuTuyen = idThongTinDuTuyen; return(View(model)); }
public async System.Threading.Tasks.Task <ActionResult> Edit(int id) { var bangCapService = this.Service <IBangCapService>(); var model = new BangCapEditViewModel(await bangCapService.GetAsync(id)); if (model == null || !model.Active) { return(HttpNotFound()); } return(View(model)); }
public async System.Threading.Tasks.Task <JsonResult> Edit(BangCapEditViewModel model) { try { var bangCapService = this.Service <IBangCapService>(); var entity = await bangCapService.GetAsync(model.Id); entity.Thang = model.Thang; entity.Nam = model.Nam; entity.BangCap1 = model.BangCap1; entity.DaNop = model.DaNop; entity.TrinhDo = model.TrinhDo; await bangCapService.UpdateAsync(entity); string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString(); var result = await new SystemLogController().Create("Sửa", controllerName, entity.Id); return(Json(new { success = true, message = "Sửa thành công!" })); } catch (Exception e) { return(Json(new { success = false, message = Resource.ErrorMessage })); } }