public AuthController(DAContext context, IAuthRepository repo, IConfiguration config, IMapper mapper) { _context = context; _repo = repo; _config = config; _mapper = mapper; }
public ActionResult Signin(Models.SigninModel model) { if (ModelState.IsValid) { User user = null; using (DAContext ctx = new DAContext()) { user = ctx.Users.SingleOrDefault(x => x.Email == model.Username && x.Password == model.Password); } if (user != null) { FormsAuthentication.SetAuthCookie(user.Email, true); return(Redirect("~")); } else { return(View()); } } else { return(View()); } }
public static User FindUserByCredentials(string p1, string p2) { User user = null; using (DAContext ctx = new DAContext()) { user = ctx.Users.SingleOrDefault(x => x.Email == p1 && x.Password == p2); } return(user); }
protected virtual void Dispose(bool disposing) { if (disposing) { if (this.db != null) { this.db.Dispose(); this.db = null; } } }
public static void AddUser(User user) { using (DAContext ctx = new DAContext()) { // check if user exists. if (ctx.Users.Where(x => x.Email == user.Email).Count() > 0) { throw new Exception("User Exists"); } else { ctx.Users.Add(user); ctx.SaveChanges(); } } }
public ActionResult Signup(Models.SignupModel model) { ViewBag.Error = ""; if (ModelState.IsValid) { User user = new User { Fullname = model.Fullname, Gender = (DataAccess.Gender)model.Gender, Email = model.Email, Password = model.Password }; try { using (DAContext ctx = new DAContext()) { if (ctx.Users.Where(x => x.Email == model.Email).Count() > 0) { ViewBag.Erroe = "User already exists."; } else { user = ctx.Users.Add(user); } } } catch (Exception ex) { ViewBag.Error = ex.Message; } } return(View()); }
public CourseCategoryServiceDb(DAContext context) { this.context = context; }
public DomainServiceDb(DAContext context) { this.context = context; }
public AuthRepository(DAContext context) { _context = context; }
public Repository() { db = new DAContext(); dbSet = db.Set <T>(); }
public UserProfileServiceDb(DAContext context) { this.context = context; }
public CourseITAcademyServiceDb(DAContext service) { this.context = service; }
public SearchCriteriaServiceDb(DAContext context) { this.context = context; }
public CourseServiceDb(DAContext courseService) { this.context = courseService; }
public DatingRepository(DAContext context) { _context = context; }
public BookmarkServiceDb(DAContext context) { this.context = context; }