public async Task <IActionResult> Update([FromBody] UpdateActivitiesViewModel vm)
        {
            var result = await _services.UpdateAsync(_mapper.Map <DirectoryDTO>(vm));

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

                return(NoContent());
            }
            return(BadRequest(result.ErrorsList));
        }
Exemple #2
0
        public async Task <IActionResult> UpdateConfirmed(UpdateActivitiesViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var result = await _services.UpdateAsync(_mapper.Map <DirectoryDTO>(vm));

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

                    return(RedirectToAction("Index"));
                }
                TempData["ErrorsListConfirmed"] = result.ErrorsList;
            }
            return(View(vm));
        }
        public async Task <IActionResult> UpdateConfirmed(ActivitiesViewModel vm)
        {
            if (ModelState.IsValid)
            {
                if (vm.HashId == null)
                {
                    return(NotFound());
                }
                var result = await _services.UpdateAsync(_mapper.Map <DirectoryDTO>(vm));

                return(result.IsValid
                    ? RedirectToAction("Index")
                    : _oops.OutPutError("Activities", "Index", result.ErrorsList));
            }
            return(View(vm));
        }