public async Task <IActionResult> DeleteCost(int id) { if (await CostExists(id)) { await _costRepository.Delete(id); return(NoContent()); } else { return(NotFound()); } }
public IHttpActionResult Delete(int Id) { if (Id == 0) { return(BadRequest("Cant Delete data")); } var cost = costRepository.GetById(Id); if (cost == null) { return(BadRequest("Cant Delete data")); } costRepository.Delete(cost); unitOfWork.Commit(); return(Ok("Data deleted successfully")); }