Exemple #1
0
 public bool AddMember(ApplicationUser user, ApplicationDbContext context)
 {
     if (Members.Contains(user)) return false;
     Members.Add(user);
     context.SaveChanges();
     return true;
 }
Exemple #2
0
 public InstrumentSkill(Instrument instrument, Proficiency proficiency, string background,
     ApplicationUser applicationUser)
 {
     ApplicationUser = applicationUser;
     Instrument = instrument;
     Proficiency = proficiency;
     BackgroundDescription = background;
 }
Exemple #3
0
 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;
 }
Exemple #4
0
 public NeedBandQuery(ApplicationUser user, Instrument instrument)
 {
     User = user;Instrument = instrument; QueryStartedOn = DateTime.Now;
 }
Exemple #5
0
 public ActionResult UserProfile(ApplicationUser user)
 {
     if (!ModelState.IsValid) return View(user);
     _db.Entry(user).State = EntityState.Modified;
     _db.SaveChanges();
     return RedirectToAction("Index", "Home");
 }
Exemple #6
0
 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);
 }