Пример #1
0
        public ActionResult Edit(int id, Persons_By_Department_View item)
        {
            var request = new Department_Request {
                Item = item
            };

            var tempService = API.Container.GetInstance <IDepartment_Service>();

            var validationErrorMessages = tempService.GetBrokenRules(item);

            if (validationErrorMessages != null && validationErrorMessages.Count() > 0)
            {
                ModelState.AddModelError("", validationErrorMessages.First());
                return(View(item));
            }

            try
            {
                var response = tempService.Update(request);

                return(RedirectToAction("Index"));
            }
            catch (Exception _error)
            {
                log.Error(_error);

                return(View());
            }
        }
Пример #2
0
        public ActionResult Delete(int id, Persons_By_Department_View item)
        {
            try
            {
                var request = new Department_Request {
                    Item = item
                };

                var tempService = API.Container.GetInstance <IDepartment_Service>();

                var response = tempService.Remove(request);

                return(RedirectToAction("Index"));
            }
            catch (Exception _error)
            {
                log.Error(_error);

                return(View());
            }
        }