示例#1
0
        public JsonResult Delete(int id)
        {
            bool          isSuccess = false;
            ActionMessage rMessage  = new ActionMessage()
            {
                Message = "Delete product success!",
                Result  = true
            };

            isSuccess = this._productDao.Delete(id);
            if (!isSuccess)
            {
                rMessage.Message = "Delete product fail!";
                rMessage.Result  = false;
            }
            return(Json(rMessage));
        }
示例#2
0
        public async Task <JsonResult> Add([FromBody] ProductView productView)
        {
            bool          isSuccess = false;
            ActionMessage rMessage  = new ActionMessage()
            {
                Message = "Add product success!",
                Result  = true
            };
            Product product = productView;

            isSuccess = this._productDao.Add(product);
            if (!isSuccess)
            {
                rMessage.Message = "Add product fail!";
                rMessage.Result  = false;
            }
            return(Json(rMessage));
        }
        public async Task <JsonResult> Add([FromBody] StoreView storeView)
        {
            bool          isSuccess = false;
            ActionMessage rMessage  = new ActionMessage()
            {
                Message = "Add store success!",
                Result  = true
            };
            Store store = storeView;

            isSuccess = this._storeDao.Add(store);
            if (!isSuccess)
            {
                rMessage.Message = "Add store fail!";
                rMessage.Result  = false;
            }
            return(Json(rMessage));
        }
        public async Task <JsonResult> Add([FromBody] CustomerView customerView)
        {
            bool          isSuccess = false;
            ActionMessage rMessage  = new ActionMessage()
            {
                Message = "Add customer success!",
                Result  = true
            };
            Customer customer = customerView;

            isSuccess = this._customerDao.Add(customer);
            if (!isSuccess)
            {
                rMessage.Message = "Add customer fail!";
                rMessage.Result  = false;
            }
            return(Json(rMessage));
        }
示例#5
0
        public async Task <JsonResult> Add([FromBody] SalesView salesView)
        {
            bool          isSuccess = false;
            ActionMessage rMessage  = new ActionMessage()
            {
                Message = "Add sales success!",
                Result  = true
            };

            int customerId = salesView.CustomerId;

            if (customerId > 0)
            {
                Customer customer = _customerDao.GetObjectById(customerId);
                salesView.Customer = customer;
            }
            int productId = salesView.ProductId;

            if (productId > 0)
            {
                Product product = _productDao.GetObjectById(productId);
                salesView.Product = product;
            }
            int storeId = salesView.StoreId;

            if (storeId > 0)
            {
                Store store = _storeDao.GetObjectById(storeId);
                salesView.Store = store;
            }

            //Sales sales = salesView;
            isSuccess = this._salesDao.Add(salesView);
            if (!isSuccess)
            {
                rMessage.Message = "Add sales fail!";
                rMessage.Result  = false;
            }
            return(Json(rMessage));
        }