コード例 #1
0
        public ActionResult ChangeGPU(cGPU gpu, int?quantity, string image)
        {
            CRUDService.ServiceClient sr = new CRUDService.ServiceClient();
            PartsStock part = new PartsStock();

            if (quantity != null)
            {
                part.Quantity = (int)quantity;
            }
            else
            {
                part.Quantity = sr.getPart(gpu.id).Quantity;
            }
            if (image != null && image != "")
            {
                part.Image = image;
            }
            else
            {
                part.Image = sr.getPart(gpu.id).image;
            }
            bool done = sr.EditGPU(gpu, part, gpu.id);

            if (done)
            {
                return(this.Redirect(Url.Action("Complete", "EditProduct")));
            }
            else
            {
                return(this.Redirect(Url.Action("GPU", "EditProduct")));
            }
        }
コード例 #2
0
        public ActionResult GPU(int id)
        {
            CRUDService.ServiceClient sr = new CRUDService.ServiceClient();
            cGPU gpu = sr.getGPU(id);

            return(View(gpu));
        }
コード例 #3
0
        public ActionResult GPU()
        {
            if (Convert.ToInt32(Session["UserType"]) != 1 && Convert.ToInt32(Session["UserType"]) != 3)
            {
                return(this.Redirect(@Url.Action("Index", "Home")));
            }
            cGPU gpu = new cGPU
            {
                active = 0
            };

            return(View(gpu));
        }
コード例 #4
0
        public ActionResult addGPU(cGPU gpu, decimal price, string image)
        {
            if (Convert.ToInt32(Session["UserType"]) != 1 && Convert.ToInt32(Session["UserType"]) != 3)
            {
                return(this.Redirect(@Url.Action("Index", "Home")));
            }
            CRUDService.ServiceClient sr = new CRUDService.ServiceClient();
            bool added = sr.addGPU(gpu, 1, price, image);

            if (added)
            {
                return(this.Redirect(Url.Action("Complete", "AddNewProduct")));
            }
            else
            {
                return(this.Redirect(Url.Action("GPU", "AddNewProduct")));
            }
        }