public async Task CreateStore(Store store) { var result = await taskHelperFactory. CreateInternetAccessViewModelInstance(loggingService /*, this*/). TryExecuteAsync(() => storeApi.Create(new StoreCreateRequest() { AutoAccept = store.AutoAccept, Name = store.Name, StoreLocation = StoreLocationRequest.Parse(store.StoreLocation), })); if (result.IsSuccess) { var storeResponse = result.Value; await OnCreateStoreSuccessful(new Store() { Id = storeResponse.Id, Name = storeResponse.Name, Products = storeResponse.Products != null ? storeResponse.Products?.Select(p => ProductsResponse.Parse(p)).ToList() : new List <Product>(), AutoAccept = storeResponse.AutoAccept, Image = storeResponse.Image, StoreLocation = storeResponse.StoreLocation != null ? StoreLocationResponse.Parse(storeResponse.StoreLocation) : null, }); } }
public static StoreLocation Parse(StoreLocationRequest request) { return(new StoreLocation() { Id = request.Id, Latitude = request.Latitude, Longitude = request.Longitude, CountryCode = request.CountryCode, CountryName = request.CountryName, FeatureName = request.FeatureName, PostalCode = request.PostalCode, SubLocality = request.SubLocality, Thoroughfare = request.Thoroughfare, SubThoroughfare = request.SubThoroughfare, Locality = request.Locality, AdminArea = request.AdminArea, StoreId = request.StoreId, SubAdminArea = request.SubAdminArea, }); }