//https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/types/how-to-convert-a-string-to-a-number public static CosmosDog ConvertToCosmosDog(Dog dog) { var myIdString = (dog.Id).ToString(); var myCosmosDog = new CosmosDog() { Id = myIdString, Name = dog.Name, FurColor = dog.FurColor, DogPictureURL = dog.DogPictureURL, DogPictureFile = dog.DogPictureFile, DogPictureSource = dog.DogPictureSource }; return(myCosmosDog); }
public static Dog ConvertToDog(CosmosDog cosmosDog) { var myIdInt = Int32.Parse(cosmosDog.Id); var myDog = new Dog() { Id = myIdInt, Name = cosmosDog.Name, FurColor = cosmosDog.FurColor, DogPictureURL = cosmosDog.DogPictureURL, DogPictureFile = cosmosDog.DogPictureFile, DogPictureSource = cosmosDog.DogPictureSource }; return(myDog); }
//PUT public static async Task PutCosmosDogAsync(CosmosDog cosmosDog2) { await myDocumentClient.ReplaceDocumentAsync(UriFactory.CreateDocumentUri(DatabaseId, CollectionId, cosmosDog2.Id), cosmosDog2); }
//DELETE public static async Task DeleteCosmosDogAsync(CosmosDog deleteCosmosDog) { await myDocumentClient.DeleteDocumentAsync(UriFactory.CreateDocumentUri(DatabaseId, CollectionId, deleteCosmosDog.Id)); }
//POST public static async Task PostCosmosDogAsync(CosmosDog cosmosDog) { await myDocumentClient.CreateDocumentAsync(UriFactory.CreateDocumentCollectionUri(DatabaseId, CollectionId), cosmosDog); }