public async Task <IActionResult> DeleteCompanyAsync(Guid id) { var com = await _companiesService.GetByIdAsync(id); if (com == null) { return(BadRequest("Company with id " + id + " doesn't exist")); } try { await _companiesService.DeleteAsync(com); return(Ok("Company with id " + id + " deleted")); } catch { return(this.ServerError("Failed to delete company with id " + id)); } }
public async Task Delete([FromQuery] int id) { await _service.DeleteAsync(id); }
public async Task <IActionResult> DeleteConfirmed(long id) { await _companiesService.DeleteAsync(id); return(RedirectToAction(nameof(Index))); }