Пример #1
0
        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();
        }
Пример #2
0
        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());
        }
Пример #4
0
 public void Delete()
 {
     _repositoryManager.Delete();
 }
Пример #5
0
 public void DeleteCar(long id)
 {
     _repository.Delete(id);
 }
Пример #6
0
        public async Task <ActionResult> Delete([FromRoute] int id)
        {
            await _manager.Delete(id);

            return(Ok());
        }