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 }; }
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); }