public ActionResult Edit(string id, LevelTypeDetailView levelTypeDetailView) { levelTypeDetailView.EmployeeView = GetEmployee(); #region Access Check bool hasPermission = GetEmployee().IsGuaranteed("LevelType_Insert"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(levelTypeDetailView)); } #endregion if (ModelState.IsValid) { try { EditLevelTypeRequestOld request = new EditLevelTypeRequestOld(); request.ID = Guid.Parse(id); request.ModifiedEmployeeID = GetEmployee().ID; request.Title = levelTypeDetailView.LevelTypeView.Title; request.RowVersion = levelTypeDetailView.LevelTypeView.RowVersion; GeneralResponse response = this._levelTypeService.EditLevelType(request); if (response.success) { return(RedirectToAction("Index")); } else { foreach (string error in response.ErrorMessages) { ModelState.AddModelError("", error); } return(View(levelTypeDetailView)); } } catch (Exception ex) { ModelState.AddModelError("", ex.Message); return(View(levelTypeDetailView)); } } return(View(levelTypeDetailView)); }
public ActionResult Create() { LevelTypeDetailView levelTypeDetailView = new LevelTypeDetailView(); levelTypeDetailView.EmployeeView = GetEmployee(); #region Access Check bool hasPermission = GetEmployee().IsGuaranteed("LevelType_Insert"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(levelTypeDetailView)); } #endregion return(View(levelTypeDetailView)); }
public ActionResult Delete(string id) { LevelTypeDetailView levelTypeDetailView = new LevelTypeDetailView(); levelTypeDetailView.EmployeeView = GetEmployee(); #region Access Check bool hasPermission = GetEmployee().IsGuaranteed("LevelType_Read"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(levelTypeDetailView)); } #endregion levelTypeDetailView.LevelTypeView = this.GetLevelTypeView(id); return(View(levelTypeDetailView)); }
public ActionResult Delete(string id, FormCollection collection) { LevelTypeDetailView levelTypeDetailView = new LevelTypeDetailView(); levelTypeDetailView.EmployeeView = GetEmployee(); #region Access Check bool hasPermission = GetEmployee().IsGuaranteed("LevelType_Delete"); if (!hasPermission) { ModelState.AddModelError("", "AccessDenied"); return(View(levelTypeDetailView)); } #endregion levelTypeDetailView.LevelTypeView = this.GetLevelTypeView(id); DeleteRequest request = new DeleteRequest() { ID = Guid.Parse(id) }; GeneralResponse response = this._levelTypeService.DeleteLevelType(request); if (response.success) { return(RedirectToAction("Index")); } else { foreach (string error in response.ErrorMessages) { ModelState.AddModelError("", error); } return(View(levelTypeDetailView)); } }