Esempio n. 1
0
 public Worker(WorkerViewModel WorkerView)
 {
     FullName = WorkerView.FullName;
     Age = WorkerView.Age;
     Education = WorkerView.Education;
     Salary = WorkerView.Salary;
     Profile = WorkerView.Profile;
     Resume = WorkerView.Resume;
     Id = WorkerView.WorkerId;
 }
Esempio n. 2
0
 public PartialViewResult WorkerPartialView()
 {
     IEnumerable<Worker> Workerss = db.Workers;
     WorkerViewModel work = new WorkerViewModel();
     work.WorkerId = -1;
     return PartialView("WorkerPartialView", work);
 }
Esempio n. 3
0
        public ActionResult Worker(WorkerViewModel WorkerView)
        {
            if (ModelState.IsValid)
            {
                Worker worker = new Models.Worker()
                {
                    FullName = WorkerView.FullName,
                    Age = WorkerView.Age,
                    Education = WorkerView.Education,
                    Salary = WorkerView.Salary,
                    Profile = WorkerView.Profile,
                    Resume = WorkerView.Resume,
                    Email = WorkerView.Email
                };
                Worker b = db.Workers.Find(WorkerView.WorkerId);
                if (b != null)
                {
                    worker.Id = WorkerView.WorkerId;
                    UpdateModel(b);
                    //db.Entry(worker).State = EntityState;
                    db.SaveChanges();

                }
                else
                {
                    Adduser(worker);
                    db.Workers.Add(worker);
                    db.SaveChanges();

                    return PartialView("Kostil");
                }
            }
            return PartialView(WorkerView);
        }
Esempio n. 4
0
 public ActionResult Worker()
 {
     IEnumerable<Worker> Workerss = db.Workers;
     WorkerViewModel work = new WorkerViewModel();
     work.WorkerId = -1;
     return View(work);
 }