Ejemplo n.º 1
0
        public ActionResult Create(Employee employee)
        {
            if (ModelState.IsValid)
            {
                employee.ID = Guid.NewGuid();
                db.Employees.Add(employee);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(employee);
        }
Ejemplo n.º 2
0
 public void EntityFrameworkTest()
 {
     DbHelper helper = new DbHelper();
     Leave l = new Leave();
     l.ID = Guid.NewGuid();
     //l.EmployId = 123;
     //l.status = LeaveApproveStatus.Pending;
     //l.Approver = "Some";
     helper.Leaves.Add(l);
     Employee e = new Employee();
     e.ID = Guid.NewGuid();
     helper.Employees.Add(e);
     var a=helper.Leaves;
     var b = helper.Employees;
 }
Ejemplo n.º 3
0
 public ActionResult Edit(Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(employee);
 }