public JsonResult CreateUserProfile()
        {
            try
            {
                //initialize domain variables.
                string domain             = ConfigurationManager.AppSettings["Domain"];
                string adminUserProfileid = ConfigurationManager.AppSettings["AdminUserRoles"];

                userProfile up          = new userProfile();
                string      userID      = User.Identity.Name;
                var         userProfile = GetUserFromLdap();

                if (userProfile != null)
                {
                    up.isAdmin  = userProfile.Item2;
                    up.userID   = userID.Replace(domain, "");
                    up.userName = userProfile.Item1;

                    //will remove this code------------------------
                    Session["username"] = userProfile.Item1;
                    Session["userid"]   = userID.Replace(domain, "");
                    //---------------------------------------------
                }

                return(Json(new { Message = up, responseCode = 200 }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception Ex)
            {
                return(Json(new { Message = "error in the system: (" + Ex.Message + ")", responseCode = 404 }, JsonRequestBehavior.AllowGet));
            }
        }
예제 #2
0
        public ActionResult DeleteConfirmed(Guid id)
        {
            userProfile userProfile = db.userProfiles.Find(id);

            db.userProfiles.Remove(userProfile);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #3
0
 public ActionResult Edit([Bind(Include = "ID,firstName,lastName,businessUnit,hireDate,Title,phone,email")] userProfile userProfile)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userProfile).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userProfile));
 }
예제 #4
0
 public ActionResult Edit([Bind(Include = "userId,userName,email")] userProfile userProfile)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userProfile).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userProfile));
 }
예제 #5
0
        public void ContactPerson(Posting companyProfile, userProfile contactUser, string contactText)
        {
            ContactRequest request = (ContactRequest)WSApplication.Application.ActivityRoot.GetDocumentFactory("ContactRequest").CreateDocument();

            request.CompanyName = companyProfile.Heading;
            //request.CompanyUrl = UrlRewriter.Instance.GetContentUrl(companyProfile.ContentType, companyProfile.ShortName);
            request.ContactText = contactText;
            request.ToAddress = contactUser.Email;

            request.Send("/ContactNotification");
        }
예제 #6
0
        public ActionResult Create([Bind(Include = "userId,userName,email")] userProfile userProfile)
        {
            if (ModelState.IsValid)
            {
                db.userProfiles.Add(userProfile);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(userProfile));
        }
예제 #7
0
        public ActionResult Create([Bind(Include = "ID,firstName,lastName,businessUnit,hireDate,Title,phone,email")] userProfile userProfile)
        {
            if (ModelState.IsValid)
            {
                userProfile.ID = Guid.NewGuid();
                db.userProfiles.Add(userProfile);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(userProfile));
        }
예제 #8
0
        // GET: userProfiles/Delete/5
        public ActionResult Delete(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            userProfile userProfile = db.userProfiles.Find(id);

            if (userProfile == null)
            {
                return(HttpNotFound());
            }
            return(View(userProfile));
        }
예제 #9
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    var userProfile = new userProfile {
                        email = model.Email, userName = model.userName, userId = user.Id
                    };
                    using (var db = new PickMEEntities()) { db.userProfiles.Add(userProfile);
                                                            db.SaveChanges(); };
                    string messageSubject = "Thank you for registering for PickME!";
                    string messageBody    = $"Dear {model.userName}, You have successfully signed up to use this website using the email {model.Email}. May your fantasy season be better than before!";
                    MessageSender.SendEmail(model.Email, messageSubject, messageBody);

                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("Account", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }