public bool Guardar(EntidadUniversidad dat) { employee1 tbl = new employee1(); tbl.id = dat.id; tbl.first_name = dat.first_name; return(metodos.Guardar(tbl)); }
public string AddEmployee(employee1 Emp) { if (Emp != null) { using (sampleEntities dataContext = new sampleEntities()) { dataContext.employee1.Add(Emp); dataContext.SaveChanges(); return("Employee Updated"); } } else { return("Invalid Employee"); } }
public string DeleteEmployee(employee1 Emp) { if (Emp != null) { using (sampleEntities dataContext = new sampleEntities()) { int no = Convert.ToInt32(Emp.id); var employeeList = dataContext.employee1.Where(x => x.id == no).FirstOrDefault(); dataContext.employee1.Remove(employeeList); dataContext.SaveChanges(); return("Employee Deleted"); } } else { return("Invalid Employee"); } }
public string UpdateEmployee(employee1 Emp) { if (Emp != null) { using (sampleEntities dataContext = new sampleEntities()) { int no = Convert.ToInt32(Emp.id); var employeeList = dataContext.employee1.Where(x => x.id == no).FirstOrDefault(); employeeList.name = Emp.name; employeeList.mobile_no = Emp.mobile_no; employeeList.email = Emp.email; dataContext.SaveChanges(); return("Employee Updated"); } } else { return("Invalid Employee"); } }