コード例 #1
0
 public IActionResult Create(Product product)
 {
     try
     {
         _OnBoardingDbUnitOfWork.GetProductRepository().Create(product);
         if (product == null)
         {
             return(NotFound("The Sales record couldn't able to add."));
         }
         return(Ok(product));
     }
     catch (Exception ex)
     {
         return(BadRequest("Error while processing request:" + ex.Message));
     }
 }
コード例 #2
0
        public IActionResult GetSales()
        {
            try
            {
                SalesResponse salesResponse = new SalesResponse();
                salesResponse.Sales     = _OnBoardingDbUnitOfWork.GetSalesRepository().GetAll();
                salesResponse.Customers = _OnBoardingDbUnitOfWork.GetCustomerRepository().GetAll();
                salesResponse.Stores    = _OnBoardingDbUnitOfWork.GetStoreRepository().GetAll();
                salesResponse.Products  = _OnBoardingDbUnitOfWork.GetProductRepository().GetAll();

                return(Ok(salesResponse));
            }
            catch (Exception ex)
            {
                return(BadRequest("Error while processing request:" + ex.Message));
            }
        }