public IHttpActionResult Putadmin_Employee(int id, admin_Employee admin_Employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != admin_Employee.EmpID)
            {
                return(BadRequest());
            }

            db.Entry(admin_Employee).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!admin_EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            admin_Employee admin_Employee = db.admin_Employee.Find(id);

            db.admin_Employee.Remove(admin_Employee);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        //Get Delete
        public ActionResult Delete(int id)
        {
            admin_Employee emp = db.admin_Employee.Find(id);

            if (emp == null)
            {
                return(HttpNotFound());
            }
            return(View(emp));
        }
Ejemplo n.º 4
0
 public ActionResult Edit(admin_Employee emp)
 {
     if (ModelState.IsValid)
     {
         db.Entry(emp).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View());
 }
Ejemplo n.º 5
0
 public ActionResult Edit(admin_Employee emp)
 {
     if (ModelState.IsValid)
     {
         db.Entry(emp).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     //ViewBag.RoleID = new SelectList(db.Roles, "RoleID", "RoleName", emp.RoleID);
     return(View(emp));
 }
Ejemplo n.º 6
0
        public ActionResult Edit(int id)
        {
            admin_Employee emp = db.admin_Employee.Single(x => x.EmpID == id);

            if (emp == null)
            {
                return(HttpNotFound());
            }
            //ViewBag.RoleID = new SelectList(db.Roles, "RoleID", "RoleName", emp.RoleID);
            return(View("Edit", emp));
        }
Ejemplo n.º 7
0
        public ActionResult Create(admin_Employee emp)
        {
            if (ModelState.IsValid)
            {
                db.admin_Employee.Add(emp);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View());
        }
        public IHttpActionResult Getadmin_Employee(int id)
        {
            admin_Employee admin_Employee = db.admin_Employee.Find(id);

            if (admin_Employee == null)
            {
                return(NotFound());
            }

            return(Ok(admin_Employee));
        }
        public IHttpActionResult Postadmin_Employee(admin_Employee admin_Employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.admin_Employee.Add(admin_Employee);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = admin_Employee.EmpID }, admin_Employee));
        }
Ejemplo n.º 10
0
        public IHttpActionResult Deleteadmin_Employee(int id)
        {
            admin_Employee admin_Employee = db.admin_Employee.Find(id);

            if (admin_Employee == null)
            {
                return(NotFound());
            }

            db.admin_Employee.Remove(admin_Employee);
            db.SaveChanges();

            return(Ok(admin_Employee));
        }