/// <summary> /// This function will update the entries in the SQL table to the inserted vales /// </summary> /// <param name="std">Student object with updated values</param> public void UpdateDL(Student std) { using (TestDBEntities context = new TestDBEntities()) { context.Entry(std).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
/// <summary> /// This function will update the entries in the SQL table to the inserted values /// </summary> /// <param name="emp">Object with updated values of the column in Employee object</param> public void UpdateDL(Employee emp) { using (TestDBEntities context = new TestDBEntities()) { context.Entry(emp).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
/// <summary> /// This function will add rows in the SQL table /// </summary> /// <param name="std">Student object which contains data to be added</param> /// <returns>primary key of the inserted row</returns> public int AddDL(Student std) { int id; using (TestDBEntities context = new TestDBEntities()) { var dto = context.Students.Add(std); context.SaveChanges(); id = dto.StudentID; } return(id); }
/// <summary> /// This function will add rows in the SQL table /// </summary> /// <param name="emp">Object with values of the row to be added</param> /// <returns>Primary key of the inserted row</returns> public int AddDL(Employee emp) { int id; using (TestDBEntities context = new TestDBEntities()) { var dto = context.Employees.Add(emp); context.SaveChanges(); id = dto.EmployeeID; } return(id); }