コード例 #1
0
        public ActionResult Create(string employer)
        {
            if (employer != null)
            {
                RolesManager role = new RolesManager();

            }
            return View();
        }
コード例 #2
0
 public ActionResult Create(string name , string password, string role)
 {
     try
     {
         RolesManager create_role = new RolesManager();
         create_role.AddUserAndRole(name , role, password);
         return RedirectToAction("Login", "Account");
     }
     catch
     {
         return View();
     }
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "Id,Title,Description,TotalHours")] job job)
        {
            //employeeId,employerId
            if (ModelState.IsValid)
            {
                RolesManager roles = new RolesManager();
                job.employeeId = roles.getUserId(System.Web.HttpContext.Current.User.Identity.Name);
                db.job.Add(job);
                db.SaveChanges();
                return RedirectToAction("GetMyJobs");
            }

            return View(job);
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "Id,Title,Description,TotalHoursWorked,PricePerHour")] job job, string employer)
        {
            if (ModelState.IsValid)
            {
                RolesManager roles = new RolesManager();
                job.employeeId = roles.getUserId(System.Web.HttpContext.Current.User.Identity.Name);
                job.employerId = employer;
                db.job.Add(job);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(job);
        }
コード例 #5
0
 public ActionResult GetMyJobs()
 {
     RolesManager roles = new RolesManager();
     var rolename = roles.getUserRole(System.Web.HttpContext.Current.User.Identity.Name);
     if (rolename == "employer")
     {
         string userId = roles.getUserId(System.Web.HttpContext.Current.User.Identity.Name);
         try
         {
             return View(db.job.Where(m => m.employerId.ToString() == userId));
         }
         catch (Exception)
         {
             return View();
         }
     }
     else
     {
         string userId = roles.getUserId(System.Web.HttpContext.Current.User.Identity.Name);
         try
         {
             return View(db.job.Where(m => m.employeeId.ToString() == userId));
         }
         catch (Exception)
         {
             return View();
         }
     }
 }
コード例 #6
0
        public ActionResult MyJobs()
        {
            var all_jobs = db.job.ToList();
            List<job> thisUserJobs = new List<job>();
            foreach (var job in all_jobs)
            {
                var name = System.Web.HttpContext.Current.User.Identity.Name;
                RolesManager role = new RolesManager();
                var userId = role.getUserId(name);
                if (job.employerId == userId)
                {
                    thisUserJobs.Add(job);
                }
            }

            return View(thisUserJobs);
        }
コード例 #7
0
        public ActionResult hire()
        {
            RolesManager roles = new RolesManager();
            var emplyers = roles.getAllEmployers();

            ViewBag.employers = roles.getAllEmployers();
            return View();
        }