/// <summary> /// Create geocache item with given geocache item data. /// </summary> /// <param name="geocacheItem">The geocache item data.</param> /// <returns>GeocacheItemModel of the created geocache item.</returns> public async Task <GeocacheItemModel> CreateGeocacheItem(IGeocacheItemModel geocacheItem) { if (geocacheItem == null) { throw new ArgumentException("Invalid geocacheItem in DataService.CreateGeocacheItem()"); } var newGeocacheItem = await GeocacheItemsQueries.CreateGeocacheItem(this.dbContext, geocacheItem); geocacheItem = GeocacheItemModelFactory.ConvertFromGeocacheItem(newGeocacheItem); return((GeocacheItemModel)geocacheItem); }
/// <summary> /// Updates the GeocacheId of the given Geocache item id. /// </summary> /// <param name="patchModel">The patch model to update the GeocacheId.</param> /// <returns>GeocacheItemModel of the updated geocache item.</returns> public async Task <GeocacheItemModel> PatchGeocacheItemGeocacheId(IGeocacheItemPatchGeocacheIdModel patchModel) { if (patchModel.Id <= 0) { throw new ArgumentException("Invalid id in DataService.PatchGeocacheItemGeocacheId()"); } if (patchModel.GeocacheId <= 0) { throw new ArgumentException("Invalid geocacheId in DataService.PatchGeocacheItemGeocacheId()"); } var newGeocacheItem = await GeocacheItemsQueries.UpdateGeocacheItemGeocacheId(this.dbContext, patchModel); var geocacheItemModel = GeocacheItemModelFactory.ConvertFromGeocacheItem(newGeocacheItem); return((GeocacheItemModel)geocacheItemModel); }