Пример #1
0
 public IActionResult DeleteExpenses(int id)
 {
     if (id < 0)
     {
         return(BadRequest());
     }
     _ExpensesRepo.DeleteExpense(id);
     return(Ok());
 }
Пример #2
0
 public async Task <IHttpActionResult> Delete(string guidString)
 {
     try
     {
         Guid guid = Guid.Parse(guidString);
         _repository.DeleteExpense(guid);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
        public IActionResult DeleteExpense(string id)
        {
            var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            if (string.IsNullOrEmpty(userId))
            {
                return(Unauthorized());
            }

            if (_expensesRepository.DeleteExpense(id, userId))
            {
                return(NoContent());
            }

            return(NotFound());
        }
Пример #4
0
        public async Task <IActionResult> DeleteExpenses([FromRoute] int id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var expenses = await _expensesRepository.GetExpense(id);

            if (expenses == null)
            {
                return(NotFound());
            }

            await _expensesRepository.DeleteExpense(expenses);

            await _expensesRepository.Save();

            return(Ok(expenses));
        }
Пример #5
0
 public ActionResult Delete(string settlementId, Guid expenseId)
 {
     _expensesRepository.DeleteExpense(settlementId, expenseId);
     return(Ok());
 }
Пример #6
0
 public int Delete(int id) => expensesRepository.DeleteExpense(id);
Пример #7
0
 public async Task DeleteExpense(int id)
 {
     await _expensesRepository.DeleteExpense(id);
 }