Example #1
0
 public AuthController(DAContext context, IAuthRepository repo, IConfiguration config, IMapper mapper)
 {
     _context = context;
     _repo    = repo;
     _config  = config;
     _mapper  = mapper;
 }
Example #2
0
        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());
            }
        }
Example #3
0
        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);
        }
Example #4
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (this.db != null)
         {
             this.db.Dispose();
             this.db = null;
         }
     }
 }
Example #5
0
 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();
         }
     }
 }
Example #6
0
        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;
 }
Example #8
0
 public DomainServiceDb(DAContext context)
 {
     this.context = context;
 }
Example #9
0
 public AuthRepository(DAContext context)
 {
     _context = context;
 }
Example #10
0
 public Repository()
 {
     db    = new DAContext();
     dbSet = db.Set <T>();
 }
 public UserProfileServiceDb(DAContext context)
 {
     this.context = context;
 }
 public CourseITAcademyServiceDb(DAContext service)
 {
     this.context = service;
 }
Example #13
0
 public SearchCriteriaServiceDb(DAContext context)
 {
     this.context = context;
 }
Example #14
0
 public CourseServiceDb(DAContext courseService)
 {
     this.context = courseService;
 }
Example #15
0
 public DatingRepository(DAContext context)
 {
     _context = context;
 }
Example #16
0
 public BookmarkServiceDb(DAContext context)
 {
     this.context = context;
 }