public ViewResult Create() { var model = new KPILogViewModel(); model.Name = "Đợt đánh giá nhân sự tháng " + DateTime.Now.ToString("MM/yyyy"); return(View(model)); }
public ActionResult Edit(KPILogViewModel model) { if (ModelState.IsValid) { if (Request["Submit"] == "Save") { var KPILog = KPILogRepository.GetKPILogById(model.Id); AutoMapper.Mapper.Map(model, KPILog); KPILog.ModifiedUserId = WebSecurity.CurrentUserId; KPILog.ModifiedDate = DateTime.Now; KPILogRepository.UpdateKPILog(KPILog); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.UpdateSuccess; return(RedirectToAction("Index")); } return(View(model)); } return(View(model)); //if (Request.UrlReferrer != null) // return Redirect(Request.UrlReferrer.AbsoluteUri); //return RedirectToAction("Index"); }
public ActionResult Detail(int?Id) { var KPILog = KPILogRepository.GetKPILogById(Id.Value); if (KPILog != null && KPILog.IsDeleted != true) { var model = new KPILogViewModel(); AutoMapper.Mapper.Map(KPILog, model); if (model.CreatedUserId != Helpers.Common.CurrentUser.Id && Helpers.Common.CurrentUser.UserTypeId != 1) { TempData["FailedMessage"] = "NotOwner"; return(RedirectToAction("Index")); } return(View(model)); } if (Request.UrlReferrer != null) { return(Redirect(Request.UrlReferrer.AbsoluteUri)); } return(RedirectToAction("Index")); }
public ActionResult Create(KPILogViewModel model) { if (ModelState.IsValid) { var KPILog = new KPILog(); AutoMapper.Mapper.Map(model, KPILog); KPILog.IsDeleted = false; KPILog.CreatedUserId = WebSecurity.CurrentUserId; KPILog.ModifiedUserId = WebSecurity.CurrentUserId; KPILog.AssignedUserId = WebSecurity.CurrentUserId; KPILog.CreatedDate = DateTime.Now; KPILog.ModifiedDate = DateTime.Now; //Lấy bảng thông số KPI var KPICatalog = KPICatalogRepository.GetKPICatalogById(model.KPICatalogId); KPILog.Description = KPICatalog.Description; KPILog.ExpectScore = KPICatalog.ExpectScore; KPILogRepository.InsertKPILog(KPILog); TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.InsertSuccess; return(RedirectToAction("Detail", new { Id = KPILog.Id })); } return(View(model)); }