Esempio n. 1
0
    public async Task <ActionResult> Delete(int id)
    {
        await _db.DeleteAsync(id);

        _logger.LogInformation("Карта {0} успешно удалена", id);

        return(Ok());
    }
        public async Task DeleteAsync(Guid id, Guid userId)
        {
            var user = await userRepository.GetAsync(userId);

            var card = user.Cards.FindIfExist(s => s.Id == id, ErrorCode.UserCardNotExist);
            await cardRepository.DeleteAsync(card);

            await cardRepository.SaveChangesAsync();
        }
Esempio n. 3
0
        public async Task <IActionResult> DeleteAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            await _repository.DeleteAsync(id.Value);

            return(NoContent());
        }
Esempio n. 4
0
    public async Task <ActionResult> Delete(int id)
    {
        try
        {
            await _db.DeleteAsync(id);

            _logger.LogInformation("Карта {0} успешно удалена", id);

            return(Ok());
        }
        catch (Exception ex)
        {
            LogError(ex);
            return(BadRequest($"Ошибка удаления карты {id}"));
        }
    }
Esempio n. 5
0
 public async Task <int> DeleteAsync()
 {
     return(await _cardRepository.DeleteAsync());
 }
Esempio n. 6
0
 /// <summary>
 /// Deletes a card from the database
 /// </summary>
 /// <param name="id">The id of the object that will be deleted</param>
 public async Task DeleteAsync(int id)
 {
     await _repo.DeleteAsync(id);
 }
 public async Task <int> DeleteAsync(int id)
 {
     return(await cardsRepository.DeleteAsync(id));
 }
        public async Task <bool> DeleteCardAsync(Guid cardId)
        {
            await cardRepository.DeleteAsync(cardId);

            return(true);
        }