Example #1
0
        //GET details
        public ActionResult Details(int id)
        {
            var svc   = new SupportGroupService();
            var model = svc.GetSupportGroupById(id);

            return(View(model));
        }
Example #2
0
        // GET: SupportGroup
        public ActionResult Index()
        {
            var service = new SupportGroupService();
            var model   = service.GetSupportGroups();

            return(View(model));
        }
Example #3
0
        public ActionResult DeletePost(int id)
        {
            var service = new SupportGroupService();

            service.DeleteSupportGroup(id);

            TempData["SaveResult"] = "Support Group was deleted.";

            return(RedirectToAction("Index"));
        }
Example #4
0
        //GET edit
        public ActionResult Edit(int id)
        {
            var service = new SupportGroupService();
            var detail  = service.GetSupportGroupById(id);
            var model   = new SupportGroupEdit
            {
                SupportGroupId = detail.SupportGroupId,
                Name           = detail.Name,
                Location       = detail.Location,
                PhoneNumber    = detail.PhoneNumber,
                Website        = detail.Website,
                Details        = detail.Details
            };

            return(View(model));
        }
Example #5
0
        public ActionResult Create(SupportGroupCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = new SupportGroupService();

            if (service.CreateSupportGroup(model))
            {
                TempData["SaveResult"] = "Support Group was created.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Support Group could not be created.");

            return(View(model));
        }
Example #6
0
        public ActionResult Edit(int id, SupportGroupEdit model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

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

            var service = new SupportGroupService();

            if (service.UpdateSupportGroup(model))
            {
                TempData["SaveResult"] = "Support Group was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Support Group could not be updated.");
            return(View(model));
        }