示例#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());
 }
 public int Delete(int id) => expensesRepository.DeleteExpense(id);
 public async Task DeleteExpense(int id)
 {
     await _expensesRepository.DeleteExpense(id);
 }