Ejemplo n.º 1
0
 public static bool DeleteUser(String userId)
 {
     var context = new ShipmentEntities3();
     int userid1 = Convert.ToInt32(userId);
     var query = from user in context.UserTables
                 where user.UserID == userid1
                 select user;
     if (query != null)
     {
         try
         {
             foreach (UserTable user in query)
             {
                 context.UserTables.Remove(user);
             }
                 context.SaveChanges();
             return true;
         }
         catch (Exception e)
         {
             return false;
         }
     }
     return false;
 }
Ejemplo n.º 2
0
 public static bool InsertUser(String userID ,String password,String country,String gender)
 {
     try
     {
         var context = new ShipmentEntities3();
         UserTable user1 = new UserTable();
         user1.UserID = Int32.Parse(userID);
         user1.Password = password;
         user1.Country = country;
         user1.Gender = gender;
         context.UserTables.Add(user1);
         context.SaveChanges();
         context.Dispose();
         return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }
Ejemplo n.º 3
0
 public static bool DeleteUser(String userId)
 {
     var context = new ShipmentEntities3();
     var query = from user in context.UserTables
                 where user.UserID.ToString() == userId
                 select user;
     if (query != null)
     {
         try
         {
             context.UserTables.Remove((UserTable)query);
             context.SaveChanges();
             return true;
         }
         catch (Exception e)
         {
             return false;
         }
     }
     return false;
 }
Ejemplo n.º 4
0
 public static bool UpdateUser(UserTable userTable)
 {
     var context = new ShipmentEntities3();
     var query = from user in context.UserTables
                 where user.UserID == userTable.UserID
                 select user;
     foreach (UserTable user in query)
     {
         user.Password = userTable.Password;
         user.Country = userTable.Country;
         user.Gender = userTable.Gender;
     }
     try
     {
         context.SaveChanges();
         return true;
     }
     catch (Exception e)
     {
         return false;
     }
 }