public async Task SubscriptionCreatedTest() { var item = await DocumentDBRepository <PushSubscriptionInformation> .GetItemAsync(sub.Id); Assert.AreEqual(item.Id, sub.Id); await DocumentDBRepository <PushSubscriptionInformation> .DeleteItemAsync(sub.Id); }
public async Task <IActionResult> DeleteEventAsync(string id, string category) { try { var categoryToUpper = CategoryToUpper(category); var singleEvent = await DocumentDBRepository <Event> .GetSingleItemAsync(d => d.Id == id && d.Category == categoryToUpper); if (singleEvent == null) { return(NotFound()); } await DocumentDBRepository <Event> .DeleteItemAsync(singleEvent.Id, singleEvent.Category); return(Ok()); } catch (Exception ex) { var error = new { message = ex.ToString(), status = StatusCodes.Status500InternalServerError }; return(new ObjectResult(error)); } }
public async Task TestDeleteConfirmedAsync() { var item = new Item { Id = "96cd7412-0aef-4631-a85d-17d1f55c630h", Student_Number = "45896354", First_Name = "testName3", Last_Name = "testDescription3", Email = "*****@*****.**", Home_Address = "testCategory3", Mobile = "4785362458", Photo_Path = "http...................3", Status = true }; // Create the item await DocumentDBRepository <Item> .CreateItemAsync(item); // Delete the item await DocumentDBRepository <Item> .DeleteItemAsync(item.Id, item.Student_Number); var returnedItem = await DocumentDBRepository <Item> .GetItemAsync(item.Id, item.Student_Number); // Verify the item returned is correct. Assert.IsNull(returnedItem); }
public void ItemIsCreated() { var id = Guid.NewGuid(); _documentDBRepository.CreateItemAsync(new Dummy { Id = id, Name = "DUMMY01" }).Wait(); var item = _documentDBRepository.GetItemAsync(id.ToString()).Result; Assert.Equal(id, item.Id); Assert.Equal("DUMMY01", item.Name); _documentDBRepository.DeleteItemAsync(id.ToString()).Wait(); }
public async Task <ActionResult> DeleteConfirmed(string id) { BingFinancial r = await DocumentDBRepository <BingFinancial> .GetItemAsync(id); await DocumentDBRepository <BingFinancial> .DeleteItemAsync(r.Id); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmed(string id) { DocReq r = await DocumentDBRepository.GetItemAsync <DocReq>(id); await DocumentDBRepository.DeleteItemAsync(r.Id); return(RedirectToAction("Index")); }
public async Task DeleteProdById(string prodid) { Product r = await DocumentDBRepository.GetItemAsync <Product>(prodid); if (r.Tag == "Product" && r.DbJobId == (string)Session["DbJobId"]) { await DocumentDBRepository.DeleteItemAsync(r.Id); } }
public async Task UnSubscribe(string endPoint) { var allSubscriptions = await DocumentDBRepository <PushSubscriptionInformation> .GetItemsAsync(s => s.EndPoint == endPoint); if (allSubscriptions.Count() > 0) { await DocumentDBRepository <PushSubscriptionInformation> .DeleteItemAsync(allSubscriptions.ElementAt(0).Id); } }
public async Task <ActionResult> DeleteTCV(string id) { TechChecklist tc = await DocumentDBRepository.GetItemAsync <TechChecklist>(id); if (tc.DbJobId == (string)Session["DbJobId"]) { await DocumentDBRepository.DeleteItemAsync(id); } return(View()); }
public async Task <ActionResult> DeleteAsync(Student student) { if (ModelState.IsValid) { await DocumentDBRepository <Student> .DeleteItemAsync(student.ID, student); return(RedirectToAction("Index")); } return(View(student)); }
public async Task <ActionResult> Delete([Bind(Include = "Id,Description,Completed")] Item item) { if (ModelState.IsValid) { await DocumentDBRepository <Item> .DeleteItemAsync(item.Id); return(RedirectToAction("Index")); } return(View(item)); }
public async Task <ActionResult> DeleteConfirmedAsync([Bind(Include = "Id")] string id) { await DocumentDBRepository <Item> .DeleteItemAsync(id); await this.auditClient.AuditAsync( AuditRequest.AsActionOn(typeof(Item), id) .AsEvent("DeletedItem") .WithNoData()); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteAsync(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } await DocumentDBRepository <UserPost> .DeleteItemAsync(id); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmedAsync([Bind(Include = "Id,Student_No,Name,Surname,Email,Address,Mobile_No,Completed")] string id, string category, string uri) { // Container Name - picture BlobManager BlobManagerObj = new BlobManager("picture"); BlobManagerObj.DeleteBlob(uri); await DocumentDBRepository <Student> .DeleteItemAsync(id, category); return(RedirectToAction("Index")); }
public async Task <ActionResult> Delete([Bind(Include = "ID")] BlogEntryModel item) { if (ModelState.IsValid) { await DocumentDBRepository <BlogEntryModel> .DeleteItemAsync(item.ID); return(RedirectToAction("Index")); } return(View(item)); }
public async Task <ActionResult> KendoDestroy(string models) { var items = JsonConvert.DeserializeObject <IEnumerable <Item> >(models); if (items != null && ModelState.IsValid) { Item item = items.FirstOrDefault(); await DocumentDBRepository <Item> .DeleteItemAsync(item.Id, item.Category); } return(Json(items, JsonRequestBehavior.AllowGet)); }
//api/Product/DeleteItemAsync/?id=b89bd472-2b66-5c83-0712-7f25dafba0c3 public async Task <bool> DeleteItemAsync([FromUri] string id) { try { var result = await DocumentDBRepository <ProductJSON> .DeleteItemAsync(id); return(true); } catch (Exception) { return(false); } }
public async Task <ActionResult> DeleteConfirmedAsync([Bind(Include = "StudentID")] string id) { Student item = await DocumentDBRepository <Student> .GetItemAsync(id); if (item.ImageUrl != null) { BlobManager BlobManagerObj = new BlobManager("picture"); BlobManagerObj.DeleteBlob(item.ImageUrl); } await DocumentDBRepository <Student> .DeleteItemAsync(id); return(RedirectToAction("Index")); }
public async Task DocumentDBRepositoryTest_GetItemAsync_ReturnsItem() { IDocumentClient documentClient = new DocumentClient(new Uri(_endPoint), _key); var cosmosClient = new CosmosClient(documentClient); var documentDBRepository = new DocumentDBRepository <Book>(cosmosClient, documentClient); var document = await documentDBRepository.CreateItemAsync(new Book()); var documentReturned = await documentDBRepository.GetItemAsync(document.Id); documentReturned.Id.Should().Equals(document.Id); await documentDBRepository.DeleteItemAsync(document.Id); documentReturned.Should().NotBeNull(); }
/// <summary> /// Signs the user out from AAD /// </summary> public static async Task Signout(string emailId, IDialogContext context) { context.ConversationData.Clear(); await context.SignOutUserAsync(ApplicationSettings.ConnectionName); await DocumentDBRepository.DeleteItemAsync(emailId); var pendingLeaves = await DocumentDBRepository.GetItemsAsync <LeaveDetails>(l => l.Type == LeaveDetails.TYPE); foreach (var leave in pendingLeaves.Where(l => l.AppliedByEmailId == emailId)) { await DocumentDBRepository.DeleteItemAsync(leave.LeaveId); } await context.PostAsync($"We have cleared everything related to you."); }
public static async Task <bool> Run([HttpTrigger(AuthorizationLevel.Function, "delete", Route = "Delete/{id}/{cityName}")] HttpRequest req, ILogger log, string id, string cityName) { log.LogInformation("C# HTTP trigger function to delete a record from Cosmos DB"); IDocumentDBRepository <Patient> Respository = new DocumentDBRepository <Patient>(); try { await Respository.DeleteItemAsync(id, "Patient", cityName); return(true); } catch { return(false); } }
public async Task <HttpResponseMessage> Delete(string id) { if (string.IsNullOrEmpty(id)) { return(Request.CreateResponse(HttpStatusCode.BadRequest)); } Employee employee = DocumentDBRepository <Employee> .GetItem(d => d.Id == id); if (employee == null) { return(Request.CreateResponse(HttpStatusCode.NotFound)); } await DocumentDBRepository <Employee> .DeleteItemAsync(id); return(Request.CreateResponse(HttpStatusCode.OK)); }
public async Task <HttpResponseMessage> DeleteProject(string id) { try { if (string.IsNullOrEmpty(id)) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } await DocumentDBRepository <Project> .DeleteItemAsync(id); return(new HttpResponseMessage(HttpStatusCode.NoContent)); } catch (Exception ex) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message)); } }
public async Task TestInsertDocuments() { var document = await DocumentDBRepository <Person> .CreateItemAsync(new Person { Age = 38, FirstName = "Andreas", LastName = "Pollak" }); Assert.IsNotNull(document); Assert.IsFalse(string.IsNullOrEmpty(document.Id)); var person = (await DocumentDBRepository <Person> .GetItemsAsync(p => p.LastName == "Pollak")).FirstOrDefault(); Assert.IsNotNull(person); Assert.IsTrue(person.FirstName == "Andreas"); Assert.IsTrue(person.LastName == "Pollak"); Assert.IsTrue(person.Age == 38); await DocumentDBRepository <Person> .DeleteItemAsync(document.Id); }
public async Task <string> Delete(string uid) { try { Hero item = await DocumentDBRepository <Hero> .GetSingleItemAsync(d => d.UId == uid); if (item == null) { return("Failed"); } await DocumentDBRepository <Hero> .DeleteItemAsync(item.Id); return("Success"); } catch (Exception ex) { return(ex.ToString()); } }
public async Task <ActionResult> Delete(Guid id) { try { // Get the file from DocumentDB var wopiFile = DocumentDBRepository <FileModel> .GetItem("Files", i => i.id == id); // Delete the record from DocumentDB await DocumentDBRepository <FileModel> .DeleteItemAsync("Files", wopiFile.id.ToString(), wopiFile); // Delete the blob await Utils.AzureStorageUtil.DeleteFile(wopiFile.id.ToString(), wopiFile.Container); //return json representation of information return(Json(new { success = true, id = id.ToString() })); } catch (Exception) { // Something failed...return false return(Json(new { success = false, id = id.ToString() })); } }
public async Task Delete(string id) { await DocumentDBRepository <Client> .DeleteItemAsync(id); }
public async Task <ActionResult> DeleteConfirmedAsync([Bind(Include = "Id")] string id) { await DocumentDBRepository <Item> .DeleteItemAsync(id); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmedAsync([Bind(Include = "StudentNo")] string id) { await DocumentDBRepository <Students> .DeleteItemAsync(id); return(RedirectToAction("Search")); }
public async Task Delete(string productId, string id) { await repository.DeleteItemAsync(productId, id); }