Пример #1
0
 public void UpdateEntry(clsTimeEntry updatedEntry)
 {
     using (TimeCardContext context = new TimeCardContext())
     {
         DbEntityEntry <clsTimeEntry> entry = context.Entry(updatedEntry);
         if (entry == null)
         {
             context.TimeCardEntries.Attach(updatedEntry);
             entry = context.Entry(updatedEntry);
         }
         entry.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Пример #2
0
 public ActionResult Edit(Employee updatedEmployee)
 {
     if (ModelState.IsValid)
     {
         var db = new TimeCardContext();
         db.Entry(updatedEmployee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(updatedEmployee));
 }