Esempio n. 1
0
        public void EditRoom(RoomDataModel room)
        {
            var entity = context.Rooms.SingleOrDefault(e => e.Id == room.Id);

            SetEntityFromRoom(entity, room);
            context.SaveChanges();
        }
Esempio n. 2
0
        private Room RoomToEntity(RoomDataModel room)
        {
            var entity = new Room();

            SetEntityFromRoom(entity, room);
            return(entity);
        }
Esempio n. 3
0
        public int AddRoom(RoomDataModel room)
        {
            var result = context.Rooms.Add(RoomToEntity(room));

            context.SaveChanges();

            return(result.Entity.Id);
        }
Esempio n. 4
0
 private void SetEntityFromRoom(Room entity, RoomDataModel room)
 {
     entity.Name        = room.Name;
     entity.Description = room.Description;
 }