internal bool TryAddNewManager(tblManager manager) { try { using (var conn = new HotelManagementEntities()) { conn.tblManagers.Add(manager); conn.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
internal bool TryAddNewEmployee(tblEmployee employee) { try { using (var conn = new HotelManagementEntities()) { conn.tblEmployees.Add(employee); conn.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
internal bool TryAddNewUserData(tblUserData userData) { try { using (var conn = new HotelManagementEntities()) { conn.tblUserDatas.Add(userData); conn.SaveChanges(); return(true); } } catch (Exception) { return(false); } }
internal bool TryUpdateEmloyeeSalary(int employeeId, string salary) { try { using (var conn = new HotelManagementEntities()) { var user = conn.tblEmployees.FirstOrDefault(x => x.EmployeeID == employeeId); if (user != null) { user.Salary = salary; conn.SaveChanges(); return(true); } return(false); } } catch (Exception) { return(false); } }
internal bool TryRemoveUserData(int userId) { try { using (var conn = new HotelManagementEntities()) { var userToRemove = conn.tblUserDatas.FirstOrDefault(x => x.UserDataID == userId); if (userToRemove != null) { conn.tblUserDatas.Remove(userToRemove); conn.SaveChanges(); return(true); } return(false); } } catch (Exception) { return(false); } }