// GET: Product/Edit
        /// <summary>
        /// Add or Edit by ID
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Editor(int?id)
        {
            ProductViewModel result = null;

            if (id.HasValue)
            {
                if (this.TempSession != null &&
                    this.TempSession.ID == id.Value)
                {
                    result = this.TempSession;
                }
                else
                {
                    Session.Remove(Constants.SESSION_TEMP_PRODUCT);
                    result           = ProductViewModel.ExecuteCreate(id.Value);
                    this.TempSession = result;
                }

                if (result == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }
            else
            {
                result           = new ProductViewModel();
                this.TempSession = result;
            }

            return(View(result));
        }
        public ActionResult Delete(int?id)
        {
            bool result = false;

            if (id.HasValue)
            {
                ProductViewModel model = ProductViewModel.ExecuteCreate(id.Value);

                if (model != null)
                {
                    model.Delete();
                    result = true;
                }
            }

            return(Json(new { Success = result }, JsonRequestBehavior.AllowGet));
        }