コード例 #1
0
 public static void delete(int id)
 {
     using (var db = new Dev_Sk_SE303Entities())
     {
         db.DeleteObject(db.Sk_User.FirstOrDefault(c => c.Id == id));
         db.SaveChanges();
     }
 }
コード例 #2
0
 public static void edit(FormCollection collection,int id)
 {
     using (var db = new Dev_Sk_SE303Entities())
     {
         Sk_User u = db.Sk_User.FirstOrDefault(c => c.Id == id);
         u.Username = collection["Username"].ToString();
         u.CreatedOn = DateTime.Today;
         u.Email = collection["Email"].ToString();
         db.SaveChanges();
     }
 }
コード例 #3
0
 public static void create(FormCollection collection)
 {
     using(var db = new Dev_Sk_SE303Entities())
     {
         Sk_User u = new Sk_User();
         u.Username = collection["Username"].ToString();
         u.CreatedOn = DateTime.Today;
         u.Email = collection["Email"].ToString();
         db.Sk_User.AddObject(u);
         db.SaveChanges();
     }
 }