Exemplo n.º 1
0
 public IActionResult Create(Worker worker)
 {
     worker.UserName = User.Identity.Name;
     db.Workers.Add(worker);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
        public IActionResult PendingJob(int jobId)
        {
            var selectedJob = db.Jobs.FirstOrDefault(j => j.JobId == jobId);

            selectedJob.Pending = true;
            db.SaveChanges();
            return(Json(selectedJob));
        }
 public IActionResult Create(Worker worker)
 {
     //is this the only connection between the two tables?
     //the two classes of user and worker are linked forever once made. unless we wanted to add functionality that allows user to disassociate two classes
     worker.UserName = User.Identity.Name;
     db.Workers.Add(worker);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 4
0
 public IActionResult Create(Worker worker)
 {
     //sets the worker user name to the same name as the user name signed in using Identity
     worker.UserName  = User.Identity.Name;
     worker.Available = true;
     db.Workers.Add(worker);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 5
0
        private static void AddTestData(MrFixItContext context)
        {
            context.Database.ExecuteSqlCommand("Delete From Jobs");

            var job1 = new Job("Fix sink", "My sink has been leaking non-stop. Very old plumbing, so I need someone to bring old parts or replace the whole system with something newer");

            context.Jobs.Add(job1);


            context.SaveChanges();
        }
Exemplo n.º 6
0
 public IActionResult Create(Job job)
 {
     db.Jobs.Add(job);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 7
0
 public IActionResult Create(Job job)
 {
     db.Jobs.Add(job);
     db.SaveChanges();
     return(RedirectToAction("Index")); // After a user creates a job, return to the Index page.
 }