Пример #1
0
        public ActionResult Edit(int id, HiveEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.Id != id)
            {
                ModelState.AddModelError("", "Id Mismatch");
                return(View(model));
            }

            var service = new HiveService();

            if (service.UpdateHive(model))
            {
                TempData["SaveResult"] = "Your Hive was been edited.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your Hive could not be edited.");
            return(View(model));
        }