Esempio n. 1
0
 public void DeleteRecord()
 {
     using (MukeshDBEntities med = new MukeshDBEntities())
     {
         person p = med.person.Where(c => c.Id == Id).SingleOrDefault();
         med.person.Remove(p);
         med.SaveChanges();
     }
 }
Esempio n. 2
0
 public void UpdateRecord()
 {
     using (MukeshDBEntities med = new MukeshDBEntities())
     {
         person p = med.person.Where(c => c.Id == Id).SingleOrDefault();
         p.Name = Name;
         p.Age  = Age;
         //  med.person.Add(p);
         med.SaveChanges();
     }
 }
Esempio n. 3
0
 public void AddRecord()
 {
     using (MukeshDBEntities med = new MukeshDBEntities())
     {
         person p = new person();
         p.Name = Name;
         p.Age  = Age;
         med.person.Add(p);
         med.SaveChanges();
     }
 }
Esempio n. 4
0
        /* public int Id { get; set; }
        *  public string Name { get; set; }
        *  public int Age { get; set; }*/

        public static List <person> getAll()
        {
            List <person> lst = null;

            using (MukeshDBEntities med = new MukeshDBEntities())
            {
                lst = (from i in med.person select i).ToList();
            }

            return(lst);
        }