Ejemplo n.º 1
0
        public ActionResult CreateJob(PeopleJobvm pjvm)
        {
            if (ModelState.IsValid)
            {
                Vaktir vakt = new Vaktir();
                vakt.Date     = pjvm.job.Date;
                vakt.End      = pjvm.job.End;
                vakt.Start    = pjvm.job.Start;
                vakt.Type     = pjvm.job.Type;
                vakt.PersonID = pjvm.job.PersonID;

                string id = pjvm.job.PersonID;
                vakt.Type = pjvm.job.Type;
                Person vaktPerson = new Person();

                vaktPerson  = dbm.allPeoples.Find(x => x.PersonID.Equals(id));
                vakt.Person = vaktPerson;
                dbm.addJob(vakt);

                String output = "Vakt no: " + vakt.VaktID + " has been added to database";
                TempData["Success"] = output;

                return(RedirectToAction("Jobs"));
            }

            pjvm.ListOfPersons = dbm.allPeoples;
            return(View(pjvm));
        }
Ejemplo n.º 2
0
        public ActionResult EditJob(PeopleJobvm viewModel)
        {
            if (ModelState.IsValid)
            {
                Vaktir v = new Vaktir();
                v.VaktID   = viewModel.id;
                v.isFree   = viewModel.job.isFree;
                v.Date     = viewModel.job.Date;
                v.Start    = viewModel.job.Start;
                v.End      = viewModel.job.End;
                v.Type     = viewModel.job.Type;
                v.PersonID = viewModel.job.PersonID;
                v.Person   = dbm.getPerson(viewModel.job.PersonID);

                dbm.updateJob(v);

                String output = "vakt no" + v.VaktID + " has been updated";
                TempData["Success"] = output;

                return(RedirectToAction("Jobs"));
            }

            viewModel.ListOfPersons = dbm.allPeoples;
            return(View(viewModel));
        }
Ejemplo n.º 3
0
        public ActionResult CreateJob()
        {
            PeopleJobvm viewModel = new PeopleJobvm();

            viewModel.ListOfPersons = dbm.allPeoples;
            return(View(viewModel));
        }
Ejemplo n.º 4
0
        public ActionResult EditJob(int id)
        {
            Vaktir v = dbm.getVakt(id);

            PeopleJobvm viewModel = new PeopleJobvm();

            viewModel.job           = v;
            viewModel.ListOfPersons = dbm.allPeoples;
            return(View(viewModel));
        }