public IActionResult DeleteCompany([FromRoute] int id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var removed = _companyRepo.DeleteCompany(id); return((removed == null) ? (IActionResult)NotFound() : Ok(removed)); }
public ActionResult DeleteCompany(Guid id) { var companyModelFromRepo = _repository.GetCompanyById(id); if (companyModelFromRepo != null) { _repository.DeleteCompany(companyModelFromRepo); _repository.SaveChanges(); return(NoContent()); } return(NotFound()); }