コード例 #1
0
        // GET: /Manage/ChangePassword
        public async Task<ActionResult> AddPerson()
        {
            ViewBag.Title = "Add Person";
            ViewBag.SaveText = "Add Person";


            var model = new PersonViewModel(Enumerations.ModifyActionRequired.Add);

            return View("AddModifyPerson", model);
        }
コード例 #2
0
        public async Task<ActionResult> AddModifyPerson(PersonViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }




            ManagePersonService.SavePerson(GetUserId(), model.ToDto());

            return RedirectToAction("Index");

        }
コード例 #3
0
        public async Task<ActionResult> ModifyPerson(string id)
        {
            ViewBag.Title = "Edit Person";
            ViewBag.SaveText = "Update Person";


            var userId = GetUserId();
            if (!ManagePersonService.CheckIfPersonBelongsToUser(userId, id))
                return View("ErrorPage", new ErrorViewModel("Unkown Person", "This Person Is Unknown"));

            var person = ManagePersonService.GetPerson(id);

            var model = new PersonViewModel(person);

            return View("AddModifyPerson", model);
        }