Ejemplo n.º 1
0
 public ActionResult UpdateContact(Contact entity)
 {
     try
     {
         ContactsDB.Entry(entity).State = System.Data.Entity.EntityState.Modified;
         ContactsDB.SaveChanges();
         return new HttpStatusCodeResult(HttpStatusCode.Accepted);
     }
     catch
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
 }
Ejemplo n.º 2
0
 public ActionResult AddContact(Contact entity)
 {
     try
     {
         ContactsDB.Contacts.Add(entity);
         ContactsDB.SaveChanges();
         return new HttpStatusCodeResult(HttpStatusCode.Created);
     }
     catch
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
 }