Beispiel #1
0
 public static Floor ToFloor(Floors dbFloor, string imageBasePath)
 {
     return new Floor
         {
             Id = dbFloor.Id,
             MapId = dbFloor.MapId,
             Name = dbFloor.Name,
             ImageUrl = imageBasePath + dbFloor.ImageUrl,
             CreationTime = dbFloor.CreationTime
         };
 }
Beispiel #2
0
        public static Floor CreateFloor(MapsEntities entities, int mapId, string name, string imageUrl)
        {
            if (!MapService.MapExists(mapId))
                throw new ServiceException(ResponseError.MapIdDoesNotExist);

            var newFloor = new Floors
                {
                    MapId = mapId,
                    Name = name,
                    ImageUrl = imageUrl,
                    CreationTime = DateTime.Now
                };
            Floors insertedFloor = entities.Floors.Add(newFloor);
            entities.SaveChanges();

            StudMapCache.RemoveMap(mapId);

            return Conversions.ToFloor(insertedFloor, ServerAdminBasePath);
        }