コード例 #1
0
        public ActionResult Register(RegisterModel model)
        {
            UpdateModel(model, new string[] { "UserName", "Password", "ConfirmPassword", "Role" });
            if (ModelState.IsValid)
            {

                MembershipCreateStatus createStatus;
                Membership.CreateUser(model.UserName, model.Password, model.UserName, null, null, true, null, out createStatus);
                Roles.AddUserToRole(model.UserName, model.Role);

                Guid id = new UserRepository().FindUserIdByEmail(model.UserName);
                new ContactRepository().CreatFaculty(new DummyFaculty().GetDummyFaculty(id));
                new ContactRepository().CreatContact(new DummyFaculty().GetDummyContact(id));
                new ContactRepository().CreatEducation(new DummyFaculty().GetDummyEducatino(id));


                new EmailSender().SendEmail(model);



                if (createStatus == MembershipCreateStatus.Success)
                {
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("", ErrorCodeToString(createStatus));
                }
            }


            return View(model);
        }
コード例 #2
0
 public ActionResult Details(Guid? id)
 {
     id = new UserRepository().FindUserIdByEmail(User.Identity.Name);
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     EducationalInformation educationalInformation = db.EducationalInformations.Find(id);
     if (educationalInformation == null)
     {
         return HttpNotFound();
     }
     return View(educationalInformation);
 }
コード例 #3
0
 public ActionResult Details(Guid? id)
 {
     id = new UserRepository().FindUserIdByEmail(User.Identity.Name);
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     Faculty faculty = db.Faculties.Find(id);
     if (faculty == null)
     {
         return HttpNotFound();
     }
     return View(faculty);
 }
コード例 #4
0
 public ActionResult Edit(Guid? id)
 {
     id = new UserRepository().FindUserIdByEmail(User.Identity.Name);
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     ContactInformation contactInformation = db.ContactInformations.Find(id);
     if (contactInformation == null)
     {
         return HttpNotFound();
     }
     ViewBag.UserId = new UserRepository().FindUserIdByEmail(User.Identity.Name);
     return View(contactInformation);
 }