public ActionResult ChangeFan(cFan fan, 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(fan.id).Quantity;
            }
            if (image != null && image != "")
            {
                part.Image = image;
            }
            else
            {
                part.Image = sr.getPart(fan.id).image;
            }
            bool done = sr.EditFan(fan, part, fan.id);

            if (done)
            {
                return(this.Redirect(Url.Action("Complete", "EditProduct")));
            }
            else
            {
                return(this.Redirect(Url.Action("Fan", "EditProduct")));
            }
        }
        public ActionResult Fan(int id)
        {
            CRUDService.ServiceClient sr = new CRUDService.ServiceClient();
            cFan part = sr.getFan(id);

            return(View(part));
        }
Example #3
0
        public ActionResult Fan()
        {
            if (Convert.ToInt32(Session["UserType"]) != 1 && Convert.ToInt32(Session["UserType"]) != 3)
            {
                return(this.Redirect(@Url.Action("Index", "Home")));
            }
            cFan part = new cFan
            {
                active = 0
            };

            return(View(part));
        }
Example #4
0
        public ActionResult addFan(cFan part, 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.addFan(part, 1, image);

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