public async Task DeleteAsync(int id, string userId) { var ingridient = await _repositoryIngridient .GetEntityAsync(ingridient => ingridient.Id == id && ingridient.UserId == userId); if (ingridient is null) { throw new KeyNotFoundException(ErrorResource.IngridientNotFound); } _repositoryIngridient.Delete(ingridient); await _repositoryIngridient.SaveChangesAsync(); }
public async Task DeleteAsync(int id, string userId) { var readymeal = await _repositoryReadyMeal .GetEntityAsync(readymeal => readymeal.Id == id && readymeal.UserId == userId); if (readymeal is null) { throw new KeyNotFoundException(ErrorResource.ReadyMealNotFound); } _repositoryReadyMeal.Delete(readymeal); await _repositoryReadyMeal.SaveChangesAsync(); }
public async Task <IActionResult> DeleteAsync(int id) { var parentModel = await _parentRepositoryManager .GetEntityWithoutTrackingAsync(parentModel => parentModel.Id == id); if (parentModel is null) { return(NotFound()); } _parentRepositoryManager.Delete(parentModel); await _parentRepositoryManager.SaveChangesAsync(); return(NoContent()); }
public void Delete() { _repositoryManager.Delete(); }
public void DeleteCar(long id) { _repository.Delete(id); }
public async Task <ActionResult> Delete([FromRoute] int id) { await _manager.Delete(id); return(Ok()); }