public bool AddMember(ApplicationUser user, ApplicationDbContext context) { if (Members.Contains(user)) return false; Members.Add(user); context.SaveChanges(); return true; }
public InstrumentSkill(Instrument instrument, Proficiency proficiency, string background, ApplicationUser applicationUser) { ApplicationUser = applicationUser; Instrument = instrument; Proficiency = proficiency; BackgroundDescription = background; }
public static Band SaveNewBandToDB(string name, ApplicationUser founder, ApplicationDbContext context) { var newBand = new Band {Name = name}; newBand.Admins.Add(founder); newBand.Members.Add(founder); newBand.CreatedOn = DateTime.Now; context.Bands.Add(newBand); context.SaveChanges(); return newBand; }
public NeedBandQuery(ApplicationUser user, Instrument instrument) { User = user;Instrument = instrument; QueryStartedOn = DateTime.Now; }
public ActionResult UserProfile(ApplicationUser user) { if (!ModelState.IsValid) return View(user); _db.Entry(user).State = EntityState.Modified; _db.SaveChanges(); return RedirectToAction("Index", "Home"); }
public async Task<ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email, LastName = model.LastName, FirstName = model.FirstName }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); return RedirectToAction("Index", "Home"); } AddErrors(result); } return View(model); }