Esempio n. 1
0
        public ActionResult ChangeSchool(UserSchoolViewModel model)
        {
            if (ModelState.IsValid)
            {
                bool result = _userManager.ChangeUserSchool(User.Identity.GetUserId(), model.SchoolName, model.SchoolClass, model.SchoolCity,
                    model.SchoolHouseNumber, model.SchoolPostalCode, model.SchoolStreet, model.SchoolPhone);

                if (result)
                    return RedirectToAction("Index", new { Message = ManageMessageId.ChangeSchoolDataSuccess });
                else
                    return RedirectToAction("Index", new { Message = ManageMessageId.Error });
            }
            else
                return View(model);
        }
Esempio n. 2
0
        public ActionResult ChangeSchool()
        {
            var dbModel = _userManager.GetUserSchoolById(User.Identity.GetUserId());
            UserSchoolViewModel viewModel;

            if (dbModel != null)
            {
                viewModel = new UserSchoolViewModel
                {
                    SchoolName = dbModel.Name,
                    SchoolCity = dbModel.City,
                    SchoolClass = dbModel.Class,
                    SchoolHouseNumber = dbModel.HouseNumber,
                    SchoolPhone = dbModel.Phone,
                    SchoolPostalCode = dbModel.PostalCode,
                    SchoolStreet = dbModel.Street
                };
            }
            else
                viewModel = new UserSchoolViewModel();

            return View(viewModel);
        }