Пример #1
0
        public async Task <IActionResult> AffectedFieldEditPost(int id, AffectedFieldWorkModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await _crudService.Edit(id, model, Token, SettingService.AffectedFieldEntity);

                AddMessageToModel(model, result.Message, !result.Success);
            }
            else
            {
                AddModelStateErrors(model);
            }

            return(View("AffectedField/Edit", model));
        }
Пример #2
0
        public async Task <IActionResult> AffectedFieldAddPost(AffectedFieldWorkModel model)
        {
            if (ModelState.IsValid)
            {
                var result = await _crudService.Create(model, Token, SettingService.AffectedFieldEntity);

                AddMessageToModel(model, result.Message, !result.Success);

                if (result.Success)
                {
                    return(RedirectToActionWithId(model, "AffectedFieldEdit", "Setting", result.Id));
                }
            }
            else
            {
                AddModelStateErrors(model);
            }

            return(View("AffectedField/Add", model));
        }
Пример #3
0
        public async Task <IActionResult> AffectedFieldEdit(int id)
        {
            AffectedFieldWorkModel model = new AffectedFieldWorkModel();

            CheckTempData(model);

            var result = await _crudService.Get <AffectedFieldModel>(id, Token, SettingService.AffectedFieldEntity);

            if (result.Success)
            {
                model.Id          = id;
                model.Name        = result.Value.Name;
                model.Description = result.Value.Description;
            }
            else
            {
                AddMessageToModel(model, result.Message);
            }

            return(View("AffectedField/Edit", model));
        }
Пример #4
0
        public IActionResult AffectedFieldAdd()
        {
            AffectedFieldWorkModel model = new AffectedFieldWorkModel();

            return(View("AffectedField/Add", model));
        }