public IActionResult Edit(vmWeekend vmWeekend) { if (ModelState.IsValid) { EmployeeWeekend employeeWeekend = db.EmployeeWeekend.GetFirstOrDefault(w => w.Id == vmWeekend.Id); employeeWeekend.EmployeeId = vmWeekend.EmployeeId; employeeWeekend.Dayname = vmWeekend.Dayname; db.EmployeeWeekend.Update(employeeWeekend); db.Save(); } return(View("Edit")); }
public IActionResult Create(vmWeekend vmWeekend) { if (ModelState.IsValid) { EmployeeWeekend employeeWeekend = new EmployeeWeekend() { EmployeeId = vmWeekend.EmployeeId, Dayname = vmWeekend.Dayname }; db.EmployeeWeekend.Add(employeeWeekend); db.Save(); } return(View("Index")); }
public IActionResult Edit(int id) { ViewBag.Employee = new SelectList(db.Employee.GetAll() .Where(e => e.IsActive == true && e.IsDeleted == false), "Id", "FullName"); EmployeeWeekend employeeWeekend = db.EmployeeWeekend.GetFirstOrDefault(w => w.Id == id); vmWeekend vmWeekend = new vmWeekend { Id = employeeWeekend.Id, Employee = employeeWeekend.Employee, EmployeeId = employeeWeekend.EmployeeId, Dayname = employeeWeekend.Dayname }; return(View("Edit", vmWeekend)); }