示例#1
0
        public async Task <IActionResult> Update([FromBody] UpdateDepartmentalViewModel vm)
        {
            var result = await _services.UpdateAsync(_mapper.Map <DepartmentalDTO>(vm));

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

                return(NoContent());
            }
            return(BadRequest(result.ErrorsList));
        }
        public async Task <IActionResult> UpdateConfirmed(UpdateDepartmentalViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var result = await _services.UpdateAsync(_mapper.Map <DepartmentalDTO>(vm));

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

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