public async Task <IActionResult> DeleteAsync(int id) { var result = new ReturnData <bool>(); result.Obj = await _service.DeleteAsync(id); return(Ok(result)); }
public async Task <IActionResult> Delete([Required] string id) { var result = await _services.DeleteAsync(id); if (result.IsValid) { await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Delete, Tables.Position); } return(Ok(result)); }
public async Task <IActionResult> Delete(Position position) { var result = await _positionService.DeleteAsync(position); if (result.Success) { return(Ok(result.Success)); } return(BadRequest(result.Message)); }
public async Task <IActionResult> DeleteConfirmed(string id) { if (id == null) { return(NotFound()); } var result = await _services.DeleteAsync(id); return(result.IsValid ? RedirectToAction("Index") : _oops.OutPutError("Position", "Index", result.ErrorsList)); }
public async Task <IActionResult> Delete(int id) { try { var entity = _service.DeleteAsync(id); return(Ok()); } catch (Exception) { return(BadRequest()); } }
public async Task <IActionResult> DeleteConfirmed([Required] string id) { var result = await _services.DeleteAsync(id); if (result.IsValid) { await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Delete, Tables.Position); return(RedirectToAction("Index")); } TempData["ErrorsList"] = result.ErrorsList; return(View()); }
public async Task DeleteAsync(long id) { var car = dataStore.Get <Car>(id); if (car == null) { throw new EntityNotFoundException($"Запись типа {typeof(Car).Name} c идентификатором {id} не существует"); } if (car.PositionId != null) { await positionService.DeleteAsync(car.PositionId.Value); } await dataStore.DeleteAsync(car); }
/// <summary> /// удаление объкта по id /// </summary> /// <param name="id">код</param> public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var position = await _positionService.GetAsync(id ?? 0); if (position == null) { return(HttpNotFound()); } await _positionService.DeleteAsync(position); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteAsync(int id) { try { await positionService.DeleteAsync(new PositionDTO { Id = id }); return(NoContent()); } catch (NotFoundException e) { return(NotFound(new { Id = id, e.Message })); } catch (DeleteNotPermittedException e) { return(Conflict(e.Message)); } }
public async Task <IActionResult> Delete(int id) { try { Position deletedDto = await _service.DeleteAsync(id, ModelState.AddModelError); if (deletedDto == null) { return(BadRequest(ModelState)); } return(Ok(deletedDto)); } catch (EntityNotFoundException <Position, int> ) { return(NotFound()); } }
public async Task <IActionResult> Delete(int id) { var result = await _service.DeleteAsync(id); return(Ok(result)); }