コード例 #1
0
 public static void delete(int id)
 {
     using (publishEntities context = new publishEntities())
     {
         publish obj = context.publishes.First(x => x.Id == id);
         context.publishes.Remove(obj);
         context.SaveChanges();
     }
 }
コード例 #2
0
        public static List <publish> getallusers()
        {
            List <publish> lst = null;

            using (publishEntities db = new publishEntities())
            {
                lst = (from u in db.publishes select u).ToList();
            }
            return(lst);
        }
コード例 #3
0
 public static void EditUpdate(int id, String place, String date1, String publisher)
 {
     using (publishEntities context = new publishEntities())
     {
         publish obj = context.publishes.First(x => x.Id == id);
         obj.publication_place = place;
         obj.publication_date  = date1;
         obj.publisher         = publisher;
         context.SaveChanges();
     }
 }
コード例 #4
0
        public static void registernew(String uname, String upass)
        {
            using (publishEntities context = new publishEntities())
            {
                register obj = new register();
                obj.username = uname;
                obj.password = upass;


                context.registers.Add(obj);

                context.SaveChanges();
            }
        }
コード例 #5
0
 public static bool adminlogin(String uname, String password)
 {
     using (publishEntities context = new publishEntities())
     {
         admin obj = (admin)context.admins.Where(x => x.username == uname).Where(x => x.password == password).FirstOrDefault();
         if (obj == null)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
 }