Exemple #1
0
 public static string DeleteUser(User user)
 {
     using (var db = new ChatFormEntities())
     {
         db.Entry(user).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
         return("User deleted");
     }
 }
Exemple #2
0
 public static string EditMessage(Message message)
 {
     using (var db = new ChatFormEntities())
     {
         try
         {
             db.Entry(message).State = System.Data.Entity.EntityState.Modified;
             db.SaveChanges();
             return("Message edited");
         }
         catch (System.Data.Entity.Infrastructure.DbUpdateException ex)
         {
             return($"Error!!! {ex.Message}");
         }
     }
 }