示例#1
0
 public ActionResult Edit(emolyee Emp)
 {
     if (ModelState.IsValid)
     {
         db.Entry(Emp).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(Emp));
 }
示例#2
0
 public ActionResult Create(emolyee Employee)
 {
     if (ModelState.IsValid)
     {
         db.emolyee.Add(Employee);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(Employee));
 }
示例#3
0
        public ActionResult Edit(int id = 0)
        {
            emolyee emp = db.emolyee.Find(id);

            if (emp == null)
            {
                return(HttpNotFound());
            }


            return(View(emp));
        }
示例#4
0
        public ActionResult Delete(int id)
        {
            try
            {
                emolyee Emp = db.emolyee.Where(x => x.empolyeeId == id).FirstOrDefault();
                db.emolyee.Remove(Emp);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
示例#5
0
        public ActionResult Deatils(int?id)
        {
            emolyee Emp = db.emolyee.Find(id);

            if (id == null)
            {
                return(new  HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest));
            }
            if (Emp == null)
            {
                return(HttpNotFound());
            }
            else
            {
                return(View(Emp));
            }
        }