예제 #1
0
        public ActionResult Specials(AdminSpecialVM model)
        {
            _specialManager = SpecialManagerFactory.Create();

            if (ModelState.IsValid)
            {
                try
                {
                    var response = _specialManager.SaveSpecial(model.Special);

                    if (!response.Success)
                    {
                        return(new HttpStatusCodeResult(500, $"Error in cloud. Message:{response.Message}"));
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                var response = _specialManager.GetAllSpecials();
                model.SetSpecialItems(response.Specials);

                return(View(model));
            }

            return(RedirectToAction("Specials"));
        }
예제 #2
0
        public ActionResult Specials()
        {
            _specialManager = SpecialManagerFactory.Create();
            var model    = new AdminSpecialVM();
            var response = _specialManager.GetAllSpecials();

            if (!response.Success)
            {
                return(new HttpStatusCodeResult(500, $"Error in cloud. Message:{response.Message}"));
            }
            else
            {
                model.SetSpecialItems(response.Specials);
                return(View(model));
            }
        }