public async Task <IActionResult> UpdateName([FromBody] UpdateNameSubdivisionViewModel vm)
        {
            var result = await _services.UpdateNameSubdivisionAsync(_mapper.Map <UpdateSubdivisionNameDTO>(vm));

            if (result.IsValid)
            {
                await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Update, Tables.Subdivisions);

                return(NoContent());
            }
            return(BadRequest(result.ErrorsList));
        }
Esempio n. 2
0
        public async Task <IActionResult> UpdateNameConfirmed(UpdateNameSubdivisionViewModel vm)
        {
            if (ModelState.IsValid)
            {
                if (vm.HashId == null)
                {
                    return(NotFound());
                }
                var result = await _services.UpdateNameSubdivisionAsync(_mapper.Map <SubdivisionDTO>(vm));

                return(result.IsValid
                    ? RedirectToAction("Index")
                    : _oops.OutPutError("Subdivision", "Index", result.ErrorsList));
            }
            return(View(vm));
        }
Esempio n. 3
0
        public async Task <IActionResult> UpdateNameConfirmed(UpdateNameSubdivisionViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var result = await _services.UpdateNameSubdivisionAsync(_mapper.Map <UpdateSubdivisionNameDTO>(vm));

                if (result.IsValid)
                {
                    await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Update, Tables.Subdivisions);

                    return(RedirectToAction("Index"));
                }
                TempData["ErrorsListConfirmed"] = result.ErrorsList;
            }
            return(View(vm));
        }