public ActionResult Create(attendance_emp attendance) { try { using (inventorymgtEntities inventorymgtEntities = new inventorymgtEntities()) { inventorymgtEntities.attendance_emp.Add(attendance); inventorymgtEntities.SaveChanges(); } // TODO: Add insert logic here return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, attendance_emp attendance) { try { using (inventorymgtEntities inventorymgtEntities = new inventorymgtEntities()) { inventorymgtEntities.Entry(attendance).State = System.Data.Entity.EntityState.Modified; inventorymgtEntities.SaveChanges(); } // TODO: Add update logic here return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Delete(int id, FormCollection collection) { try { using (inventorymgtEntities inventorymgtEntities = new inventorymgtEntities()) { attendance_emp attendance1 = inventorymgtEntities.attendance_emp.Where(x => x.empId == id).FirstOrDefault(); inventorymgtEntities.attendance_emp.Remove(attendance1); inventorymgtEntities.SaveChanges(); } // TODO: Add delete logic here return(RedirectToAction("Index")); } catch { return(View()); } }