Ejemplo n.º 1
0
        public JsonResult Edit(Employee employee)
        {
            CrudOpDbContext db = new CrudOpDbContext();

            db.Entry(employee).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(Json(employee, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 2
0
        public JsonResult Create(Employee employee)
        {
            CrudOpDbContext db = new CrudOpDbContext();

            db.Employees.Add(employee);
            db.SaveChanges();
            return(Json(employee, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public JsonResult Delete(int ID)
        {
            CrudOpDbContext db       = new CrudOpDbContext();
            Employee        employee = new Employee();

            employee = db.Employees.Find(ID);
            db.Entry(employee).State = System.Data.Entity.EntityState.Deleted;
            db.SaveChanges();
            return(Json(employee, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        public JsonResult SaveEmployee(Employee _oEmployee)
        {
            CrudOpDbContext db = new CrudOpDbContext();

            db.Employees.Add(_oEmployee);
            db.SaveChanges();

            List <Employee> ListOfEmployee = db.Employees.ToList();

            return(Json(ListOfEmployee, JsonRequestBehavior.AllowGet));
        }