Ejemplo n.º 1
0
        public ActionResult Create()
        {
            LevelConditionDetailView levelConditionDetailView = new LevelConditionDetailView();

            levelConditionDetailView.EmployeeView = GetEmployee();

            return(View(levelConditionDetailView));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(string id, LevelConditionDetailView levelConditionDetailView)
        {
            #region Check Access
            bool hasPermission = GetEmployee().IsGuaranteed("LevelCondition_Update");
            if (!hasPermission)
            {
                ModelState.AddModelError("", "AccessDenied");
                return(View(levelConditionDetailView));
            }
            #endregion

            if (ModelState.IsValid)
            {
                try
                {
                    EditLevelConditionRequest request = new EditLevelConditionRequest();

                    request.ID = Guid.Parse(id);
                    request.ModifiedEmployeeID = GetEmployee().ID;
                    request.ConditionID        = levelConditionDetailView.LevelConditionView.Condition.ID;
                    request.LevelID            = levelConditionDetailView.LevelConditionView.LevelID;
                    request.RowVersion         = levelConditionDetailView.LevelConditionView.RowVersion;

                    GeneralResponse response = this._levelConditionService.EditLevelCondition(request);

                    if (response.success)
                    {
                        return(RedirectToAction("Index"));
                    }
                    else
                    {
                        foreach (string error in response.ErrorMessages)
                        {
                            ModelState.AddModelError("", error);
                        }
                        return(View(levelConditionDetailView));
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    return(View(levelConditionDetailView));
                }
            }

            return(View(levelConditionDetailView));
        }
Ejemplo n.º 3
0
        public ActionResult Delete(string id)
        {
            LevelConditionDetailView levelConditionDetailView = new LevelConditionDetailView();

            #region Check Access
            bool hasPermission = GetEmployee().IsGuaranteed("LevelCondition_Delete");
            if (!hasPermission)
            {
                ModelState.AddModelError("", "AccessDenied");
                return(View(levelConditionDetailView));
            }
            #endregion

            levelConditionDetailView.LevelConditionView = this.GetLevelConditionView(id);
            //levelConditionDetailView.EmployeeView = GetEmployee();

            return(View(levelConditionDetailView));
        }