Exemplo n.º 1
0
 public IHttpActionResult Delete(SaleViewModel model)
 {
     if (!ModelState.IsValid)
     {
         BadRequest();
     }
     else
     {
         _serviceSale.DeleteSale(model.SaleId);
         return(Ok());
     }
     return(Ok());
 }
Exemplo n.º 2
0
        public async Task <IActionResult> Delete(int id, SaleViewModel model)
        {
            try
            {
                await _saleService.DeleteSale(id);

                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                ViewData["Id"] = id;
                return(View());
            }
        }
Exemplo n.º 3
0
        public JsonResult Delete(SaleViewModel saleViewModel)
        {
            bool   isSuccess;
            string exceptionMessage = string.Empty;

            try
            {
                _saleService.DeleteSale(saleViewModel);
                isSuccess = true;
            }
            catch (Exception exception)
            {
                exceptionMessage = exception.Message;
                isSuccess        = false;
            }

            return(Json(new { isSuccess = isSuccess, exceptionMessage = exceptionMessage }));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Delete([FromRoute] int id)
        {
            var sale = await _saleService.SearchSale(id);

            // check out if exists and get object Entity
            if (sale == null)
            {
                return(NotFound());
            }

            try
            {
                await _saleService.DeleteSale(sale);
            }
            catch (DbUpdateException ex)
            {
                Console.WriteLine(ex);
                return(BadRequest());
            }

            return(Ok(sale));
        }
        public async Task <IActionResult> DeleteSale(Guid idSale)
        {
            await _saleService.DeleteSale(idSale);

            return(await ResponseAsync());
        }
Exemplo n.º 6
0
 public void Delete(int id)
 {
     saleService.DeleteSale(id);
 }