public bool Delete(int id) { var producer = _repository.FindById(id); _repository.Delete(producer); return(_repository.SaveChanges()); }
public async Task <ActionResult> Delete(long id) { try { await _producer.Delete(id); } catch (Exception) when(!ProducerExists(id)) { return(NotFound()); } return(Ok()); }
public async Task <IDictionary <string, object> > Delete(int id) { try{ // var producer = await _producerRepo.GetBy(id); // if (producer == null) // { // return NotFound(); // } await _producerRepo.Delete(id); return(Const.Response.ControlerResponse(Const.StatusCode.OK, "Action complete successfully")); } catch (Exception e) { Console.WriteLine(e.ToString()); return(Const.Response.ControlerResponse(Const.StatusCode.InternalServerError, e.ToString())); } }
public void Delete(Producer producer) { _producerRepository.Delete(producer); }
public void Delete(int id) { _producerRepository.Delete(id); }