public async System.Threading.Tasks.Task <ActionResult> Edit(QuaTrinhHocTapEditViewModel model) { try { var quaTrinhHocTapService = this.Service <IQuaTrinhHocTapService>(); var entity = await quaTrinhHocTapService.GetAsync(model.Id); if (!model.DaTotNghiep.HasValue) { model.DaTotNghiep = false; } model.CopyToEntity(entity); entity.DaTotNghiep = model.DaTotNghiep; entity.Active = true; entity.LoaiTruong = (int)model.EducationLevel; entity.IdThongTinCaNhan = model.IdThongTinCaNhan; await quaTrinhHocTapService.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 })); } }
public ActionResult Create(int idThongTinCaNhan) { var quaTrinhHocTapService = this.Service <IQuaTrinhHocTapService>(); var model = new QuaTrinhHocTapEditViewModel() { IdThongTinCaNhan = idThongTinCaNhan, EducationLevel = (EducationLevel)0, DaTotNghiep = false, }; return(View(model)); }
public async System.Threading.Tasks.Task <ActionResult> Edit(int id) { var quaTrinhHocTapService = this.Service <IQuaTrinhHocTapService>(); var model = new QuaTrinhHocTapEditViewModel(await quaTrinhHocTapService.GetAsync(id)); if (model == null || model.Active == false) { return(Json(new { success = false, })); } model.EducationLevel = (EducationLevel)model.LoaiTruong; return(View(model)); }