public MarkerWcf[] GetMarkersOfUser(string userName) { Marker[] markers = bll.GetMarkersOfUser(userName); List <MarkerWcf> markersWcf = new List <MarkerWcf>(); foreach (var item in markers) { MarkerWcf marker = new MarkerWcf() { Name = item.Name, City = item?.Address.City.Name, Contacts = item?.Contacts.Select(c => c.Name).ToArray(), Street = item?.Address.Street, Number = item?.Address.Number, Description = item.Description, Lat = item.Lat, Lng = item.Lng, MarkerType = item?.Type.Name, Picture = item.Picture, UserName = item?.Login.Name }; markersWcf.Add(marker); } return(markersWcf.ToArray()); }
public MarkerWcf[] GetAllMarkersDto() { //Marker[] markers = bll.GetMar; MarkerDto[] markersDto = bll.GetAllMarkersDto(); List <MarkerWcf> markersWcf = new List <MarkerWcf>(); foreach (var item in markersDto) { MarkerWcf marker = new MarkerWcf() { Id = item.Id, Name = item.Name, City = item.City, Contacts = item.Contacts, Street = item.Street, Number = item.Number, Description = item.Description, Lat = item.Lat, Lng = item.Lng, MarkerType = item.MarkerType, Picture = item.Picture, UserName = item.UserName }; markersWcf.Add(marker); } return(markersWcf.ToArray()); }
public MarkerWcf[] GetMarkersOfType(string markerType, string city) { Marker[] markers = bll.GetMarkersOfType(markerType, city); MarkerDto[] markersDto = bll.GetMarkersDtoOfType(markerType, city); List <MarkerWcf> markersWcf = new List <MarkerWcf>(); foreach (var item in markersDto) { MarkerWcf marker = new MarkerWcf() { Name = item.Name, City = item.City, Contacts = item.Contacts, Street = item.Street, Number = item.Number, Description = item.Description, Lat = item.Lat, Lng = item.Lng, MarkerType = item.MarkerType, Picture = item.Picture, UserName = item.UserName }; markersWcf.Add(marker); } //foreach (var item in markers) //{ // MarkerWcf marker = new MarkerWcf() // { // Name = item.Name, // City = item.Address.City.Name, // Contacts = item.Contacts.Select(c => c.Name).ToArray(), // Street = item.Address.Street, // Number = item.Address.Number, // Description = item.Description, // Lat = item.Lat, // Lng = item.Lng, // MarkerType = item.Type.Name, // Picture = item.Picture, // UserName = item.Login.Name // }; // markersWcf.Add(marker); //} return(markersWcf.ToArray()); }
public void UpdateMarker(MarkerWcf newMarker) { MarkerDto markerDto = new MarkerDto() { Id = newMarker.Id, Name = newMarker.Name, City = newMarker.City, Street = newMarker.Street, Number = newMarker.Number, Description = newMarker.Description, Lat = newMarker.Lat, Lng = newMarker.Lng, UserName = newMarker.UserName, Picture = newMarker.Picture, MarkerType = newMarker.MarkerType, Contacts = newMarker.Contacts }; bll.UpdateMarker(markerDto); }