public async Task <Listing> CreateAsync(CreateListing listing) { ThrowHelper.ThrowIfNull(listing, nameof(listing)); var request = new { listing }; return(await ApiConnection.ExecutePostAsync <object, Listing>(Route, request).ConfigureAwait(false)); }
public object Post(CreateListing request) { Listing newAd = new Listing(); newAd = request.ConvertTo<Listing>(); using (IDbConnection db = DbFactory.Open()) { var imageUrls = request.Files.Split(';'); foreach (var url in imageUrls) {if (url!= "") newAd.ImageUrls.Add(new ImageModel {IsPrimary = false, Name = url, Url = url}); } db.Save(newAd); } return new CreateListingResponse { Result = true }; }