예제 #1
0
        public async Task <IActionResult> EnableSale(int id)
        {
            DataResponse response = new DataResponse();

            try
            {
                var sale = await _saleService.GetById(id);

                if (sale == null)
                {
                    response.Message = "The sale is not found.";
                    return(NotFound(response));
                }
                await _saleService.EnableSale(sale);

                response.Success = 1;
                response.Message = "The sale has been enabled.";
                return(Ok(response));
            }
            catch (Exception ex)
            {
                response.Message = ex.Message;
                return(StatusCode(500, response));
            }
        }