public ActionResult Authorized(Users user)
        {
            if (!ModelState.IsValid)

            {
                return(View());
            }
            using (JobRegistryDBContext db = new JobRegistryDBContext())

            {
                Users u = db.Users.FirstOrDefault(model => model.UserName == user.UserName);

                if (u != null)
                {
                    ModelState.AddModelError("", "This username already exists.");
                    return(View());
                }

                db.Users.Add(user);
                db.SaveChanges();
            };
            return(RedirectToAction("Login"));

            //Get User login
        }
Exemple #2
0
 // GET: JobSeeker/Details/5
 public ActionResult Details(int id)
 {
     using (JobRegistryDBContext dbmodel = new JobRegistryDBContext())
     {
         return(View(dbmodel.JobSeekers.Where(x => x.ID == id).FirstOrDefault()));
     }
 }
 public ActionResult Login(Users user)
 {
     using (JobRegistryDBContext db = new JobRegistryDBContext())
     {
         var usr = db.Users.Single(u => u.UserName == user.UserName && u.Password == user.Password);
         if (usr != null)
         {
             Session["UserID"]   = usr.ID.ToString();
             Session["Username"] = usr.UserName.ToString();
             return(RedirectToAction("Index", "Home"));
         }
         else
         {
             ModelState.AddModelError("", "Username or Password is wrong.");
         }
     }
     return(View());
 }
Exemple #4
0
        public ActionResult Create(JobSeeker jobSeeker)
        {
            try
            {
                // Create Jobseeker Details

                using (JobRegistryDBContext dbmodel = new JobRegistryDBContext())
                {
                    dbmodel.JobSeekers.Add(jobSeeker);
                    dbmodel.SaveChanges();
                }

                return(RedirectToAction("JobRegistration"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult AddJobs(JobDetail JobId)
        {
            try
            {
                // Create Jobseeker Details

                using (JobRegistryDBContext dbmodel = new JobRegistryDBContext())
                {
                    dbmodel.JobDetails.Add(JobId);
                    dbmodel.SaveChanges();
                }

                return(RedirectToAction("AddJobs"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #6
0
 // GET: JobSeeker
 public ActionResult JobRegistration()
 {
     using (JobRegistryDBContext dbmodel = new JobRegistryDBContext())
         return(View(dbmodel.JobSeekers.ToList()));
 }
 // GET: Jobs
 public ActionResult Joblist()
 {
     using (JobRegistryDBContext dbmodel = new JobRegistryDBContext())
         return(View(dbmodel.JobDetails.ToList()));
 }