public static Room AddRoom(Room room) { try { using (var dbContext = new AutoLuminosityDataDataContext()) { var roomDb = dbContext.AutoLuminosity_Rooms.FirstOrDefault(i => string.Equals(i.RoomExternalId, room.ExternalId)); if (roomDb == null) { // Create a new db Item object to store into the queue roomDb = new AutoLuminosity_Room() { RoomName = room.Name, UserId = room.UserId, RoomCreateDate = DateTime.UtcNow, RoomExternalId = room.ExternalId }; // Insert our newly created Item and Submit the change to the db dbContext.AutoLuminosity_Rooms.InsertOnSubmit(roomDb); dbContext.SubmitChanges(); } room.Id = roomDb.RoomId; } } catch (Exception ex) { // Log error message } return(room); }
partial void UpdateAutoLuminosity_Room(AutoLuminosity_Room instance);
partial void DeleteAutoLuminosity_Room(AutoLuminosity_Room instance);
partial void InsertAutoLuminosity_Room(AutoLuminosity_Room instance);