Example #1
0
        // Update attendee : Get
        public ActionResult Update(int id    = 0, int p = 1, int ps = 50, string sv = "",
                                   string ra = "Index")
        {
            if (id <= 0)
            {
                return(RedirectToAction(nameof(Index)));
            }

            var model = _attendeeService.GetForEdit(id);

            StorePaging(p, ps, sv);
            model.PageNum  = PageNumber;
            model.PageSize = PageSize;

            // Store the Return Action - ra
            ViewData["ReturnAction"] = ra == "Details" ? "Details" : "Index";

            // If the id is 0, return to list of attendees
            // This means attendee was not found
            if (model.Id == 0)
            {
                return(RedirectToAction(nameof(Index)));
            }

            return(View(model));
        }