public bool AddRtype(RoomTypeTbl rt, string User) { if (rt != null) { try { int max = db.RoomTypeTbls.Max(r => r.RowId); rt.RoomTypeID = GetID(max, "Room"); rt.UpdateBy = User; rt.UpdateDate = DateTime.Now; db.RoomTypeTbls.Add(rt); db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } } return(false); }
public bool AddEmployee(EmployeeTbl employee, List <Days> days, List <Times> times, byte[] ProfilePic, string User, bool IsActive = true) { if (employee != null) { try { employee.IsActive = IsActive; employee.Day = workingDays(days); employee.Time = workingTimes(times); employee.Image = imageValidation(ProfilePic); //add PP.jpg at Bin Dir db.EmployeeTbls.Add(employee); db.SaveChanges(); return(true); } catch { return(false); } } else { return(false); } }