public IRoom EditRoom(IRoom r) { var ret = _db.Rooms.Where(ro => ro.Id == r.Id).FirstOrDefault(); if (ret == null) return null; var room = new Room() { Id = r.Id, Floor = r.Floor, Location = r.Location, RoomName = r.RoomName, SizeM2 = r.SizeM2 }; _db.Rooms.AddOrUpdate(room); _db.SaveChanges(); return room; }
public IRoom AddRoom(IRoom r) { var room = new Room() { Id = r.Id, Floor = r.Floor, Location = r.Location, RoomName = r.RoomName, SizeM2 = r.SizeM2 }; var ret = _db.Rooms.Add(room); _db.SaveChanges(); return ret; }