예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            EmployeeApp tblEmployee = db.Employees.Find(id);

            db.Employees.Remove(tblEmployee);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "Name_Employee,Age_Employee,Poste_Employee")] EmployeeApp Employees)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(Employees);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }


            return(RedirectToAction("Create"));
        }
예제 #3
0
        public ActionResult Edit(int id)
        {
            EmployeeApp tblEmployee = db.Employees.Find(id);

            UpdateModel <IEmployee>(tblEmployee);
            if (ModelState.IsValid)
            {
                db.Entry(tblEmployee).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblEmployee));
        }
예제 #4
0
        // GET: tblEmployees/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmployeeApp tblEmployee = db.Employees.Find(id);

            if (tblEmployee == null)
            {
                return(HttpNotFound());
            }
            return(View(tblEmployee));
        }