private async Task cleanCollection() { IAsyncRepositoryFactory factory = new MongoAsyncRepositoryFactory(connectionString, "testDb"); IAsyncRepository <Entity> entityRepository = factory.CreateAsyncRepository <Entity>("testCollection"); var list = await entityRepository.Find(x => true); foreach (var entity in list) { await entityRepository.Delete(x => x.Id == entity.Id); } }
public async Task <ServiceResult> Delete(int id) { var project = await _projectRepository.GetById(id); if (project == null) { return(EntityNotFound()); } await _projectRepository.Delete(project); return(Ok()); }
public async Task <IHttpActionResult> Delete(long id) { var entity = await Repository.Get(id); if (entity == null) { return(NotFound()); } await Repository.Delete(entity); return(Ok(entity)); }
public async Task <ServiceResult> Delete(int id) { var action = await _actionRepository.GetById(id); if (action == null) { return(EntityNotFound()); } await _actionRepository.Delete(action); return(Ok()); }
public async Task <IActionResult> DeleteMark(int id, string returnUrl) { var mark = await _marks.GetById(id); if (mark == null) { return(NotFound()); } await _marks.Delete(mark.Id); return(RedirectToReturnUrlOrHome(returnUrl)); }
public async Task DeleteEntityTest() { IAsyncRepositoryFactory factory = new MongoAsyncRepositoryFactory(connectionString, "testDb"); IAsyncRepository <Entity> entityRepository = factory.CreateAsyncRepository <Entity>("testCollection"); var initial = new Entity() { Id = Guid.NewGuid(), Name = "created" }; await entityRepository.Create(initial); var deleted = await entityRepository.Delete(x => x.Id == initial.Id); Assert.True(deleted == 1); }
public async Task <IActionResult> Delete(int id, string returnUrl) { var clothes = await _clothesStore.GetById(id); if (clothes == null) { return(NotFound()); } try { if (clothes.ImageName != null) { System.IO.File.Delete(Path.Combine(_enviroments.WebRootPath, "uploads//clothes", clothes.ImageName)); } } catch (Exception) { } await _clothesStore.Delete(id); return(RedirectToReturnUrlOrHome(returnUrl)); }
public async Task RemoveClaim(UserDto user, Claim claim) { if (user == null) { throw new ArgumentNullException("user"); } if (claim == null) { throw new ArgumentNullException("claim"); } IEnumerable <IdentityUserClaim> claims = user.Claims.Where(uc => uc.ClaimValue == claim.Value && uc.ClaimType == claim.Type).ToList(); foreach (var c in claims) { await _claimRepository.Delete(c); } Task.FromResult(0); }
public Task DeleteUser(UserDto user) { return(_userRepository.Delete(_mapper.Map <User>(user))); }
public virtual async Task Delete(int id) { var reg = await _repository.SearchById(id); await _repository.Delete(reg); }
public async Task DeleteGroup(Group model) { _groupRepository.Delete(model); await _groupRepository.SaveChangesAsync(); }
public void DeleteFoodById(int id) { _repo.Delete(id); }
public async Task <ActionResult> DeleteConfirmed(long id) { await Repository.Delete(id); return(RedirectToAction("Index")); }
public async Task RemoveOrder(int id) { await _orders.Delete(id); }