public async Task <IActionResult> DeleteConfirmed(int id)
        {
            var sale = await saleRepository.GetByIdAsync(id);

            await saleRepository.DeleteAsync(sale);

            return(RedirectToAction(nameof(Index)));
        }
Exemple #2
0
 public async Task <ApiError> DeleteAsync(SaleModel model)
 {
     if (model is null)
     {
         return(new(Strings.InvalidModel));
     }
     try
     {
         return(ApiError.FromDalResult(await _saleRepository.DeleteAsync(model.Id)));
     }
     catch (Exception ex)
     {
         return(ApiError.FromException(ex));
     }
 }