예제 #1
0
파일: Band.cs 프로젝트: brgoza/BandAide
 public bool AddMember(ApplicationUser user, ApplicationDbContext context)
 {
     if (Members.Contains(user)) return false;
     Members.Add(user);
     context.SaveChanges();
     return true;
 }
예제 #2
0
 public InstrumentSkill(Instrument instrument, Proficiency proficiency, string background,
     ApplicationUser applicationUser)
 {
     ApplicationUser = applicationUser;
     Instrument = instrument;
     Proficiency = proficiency;
     BackgroundDescription = background;
 }
예제 #3
0
파일: Band.cs 프로젝트: brgoza/BandAide
 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;
 }
예제 #4
0
 public NeedBandQuery(ApplicationUser user, Instrument instrument)
 {
     User = user;Instrument = instrument; QueryStartedOn = DateTime.Now;
 }
예제 #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");
 }
예제 #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);
 }