Esempio n. 1
0
 public ActionResult Register(User _user)
 {
     if (ModelState.IsValid)
     {
         var check = db.Users.FirstOrDefault(s => s.Username == _user.Username);
         if (check == null)
         {
             _user.Password = GetMD5(_user.Password);
             db.Configuration.ValidateOnSaveEnabled = false;
             db.Users.Add(_user);
             db.SaveChangesAsync();
             return(RedirectToAction("Index"));
         }
         else
         {
             ViewBag.error = "Username already exists";
             return(View());
         }
     }
     return(View());
 }
Esempio n. 2
0
 public async Task AddNewUserAsync(User user)
 {
     _db.Users.Add(user);
     await _db.SaveChangesAsync();
 }
Esempio n. 3
0
 public async Task AddNewVenueAsync(Venue venue)
 {
     _context.Venues.Add(venue);
     await _context.SaveChangesAsync();
 }