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

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

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

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

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