public static void UpdateDept(int id, string deptname) { Model_Emp_DBContainer db = new Model_Emp_DBContainer(); Deptdemo update = db.Deptdemoes.Find(id); update.Name = deptname; db.SaveChanges(); }
public static void DeleteDept(int id) { Model_Emp_DBContainer db = new Model_Emp_DBContainer(); Deptdemo todel = db.Deptdemoes.Find(id); db.Deptdemoes.Remove(todel); db.SaveChanges(); }
public static void AddNewDept(string deptname) { Model_Emp_DBContainer db = new Model_Emp_DBContainer(); Deptdemo dd = new Deptdemo() { Name = deptname }; db.Deptdemoes.Add(dd); db.SaveChanges(); //Deptdemo dd1 = db.Deptdemoes.Last<Deptdemo>(); //Console.WriteLine("New dept added\n{0}\t{1}", dd1.Id, dd1.Name); }