public ActionResult Like(string id) { var userId = User.Identity.GetUserId(); var logedinProfile = db.UserProfiles.Find(userId); var profileLinker = new ProfileLinker { ID = db.ProfileLinkers.Count(), Liked = true, Favorited = false, LinkedProfile = userId, UserLinkedId = id }; db.ProfileLinkers.Add(profileLinker); db.SaveChanges(); var RedirectUrl = UserProfile.NextProfile(id, db, HttpContext); return(Redirect(RedirectUrl)); }
private void CreateUserProfile(RegisterViewModel model, ApplicationUser user /*, Photo photo*/) { UserManager.AddToRole(user.Id, "Renter"); var userProfile = new UserProfile { EmailAddress = model.Email, Description = model.Description, FirstName = model.FirstName, LastName = model.LastName, PropertyBool = model.PropertyBool, PhoneNumber = model.PhoneNumber, Id = user.Id, City = model.City //, //Photo=photo }; using (var db = new RoomieEntities()) { try { db.UserProfiles.Add(userProfile); db.SaveChanges(); var subject = "Thank you for Registering"; var body = "Thank you, " + model.FirstName + ", so much for registering good luck finding a roommate with Roomie!"; MessageSender.SendEmail(model.Email, subject, body, MessageSender.BodyType.Text); } catch (Exception e) { e = e; } } }
private void CreateAppartmentOwnerProfile(RegisterViewModel model, ApplicationUser user) { UserManager.AddToRole(user.Id, "Owner"); var appartmentOwner = new AppartmentOwner { id = user.Id, EmailAddress = model.Email, FirstName = model.FirstName, LastName = model.LastName, PhoneNumber = model.PhoneNumber }; using (var db = new RoomieEntities()) { try { db.AppartmentOwners.Add(appartmentOwner); db.SaveChanges(); var subject = "Thank you for Registering"; var body = "Thank you, " + model.FirstName + ", so much for registering good luck finding a tenant with Roomie!"; MessageSender.SendEmail(model.Email, subject, body, MessageSender.BodyType.Text); } catch (Exception e) { e = e; } } }