public PartialViewResult EditButton(int itemID)
        {
            if (!SessionManager.IsLoggedIn)
            {
                return(null);
            }

            if (Authorisation.CanEditProduct(SessionManager.UserToken))
            {
                return(PartialView("_EditButton", itemID));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 2
0
        public ActionResult EditItem(Product product)
        {
            if (Authorisation.CanEditProduct(SessionManager.UserToken))
            {
                if (ModelState.IsValid)
                {
                    bool editSuccess = ProductRepository.ModifyProduct(product);

                    if (editSuccess)
                    {
                        return(ItemDetail(product.ID));
                    }
                    else
                    {
                        return(View("Error"));
                    }
                }
                else
                {
                    return(View("EditItem", product));
                }
            }
            return(View("Error"));
        }