public async Task <CommandDto?> DeleteCommand(int id) { var deleted = await _commandRepository.Delete(id); if (deleted is null) { return(null); } return(ConvertModelToDto((await _commandRepository.Delete(id)) !)); }
public void test_delete_of_department_should_delete_the_underlying_employee() { //Arrange using (ICommandRepository <Department> departmentCommandRepository = GetCommandRepositoryInstance <Department>()) using (ICommandRepository <Employee> employeeCommandRepository = GetCommandRepositoryInstance <Employee>()) using (IQueryableRepository <Employee> employeeQueryableRepository = GetQueryableRepositoryInstance <Employee>()) { //Arrange Department departmentFake = FakeData.GetDepartmentFake(); Employee employeeFake = FakeData.GetEmployeeFake(); employeeFake.EmployeeName = "XYZ"; employeeFake.DeptID = departmentFake.Id; employeeFake.Department = departmentFake; //Action //Employee insert will automatically insert the department object before inserting this employee object //since department object is marked as required in the employee map. employeeCommandRepository.Insert(employeeFake); // Should delete the employee object automatically since the map is defined so // (WillCascadeOnDelete is set to true). departmentCommandRepository.Delete(departmentFake); //Assert employeeQueryableRepository.Count().Should().Be(0); }; }
public async Task <DeleteCommandResponse> Delete(DeleteCommandRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } var command = await commandRepository.Get(step.Id, request.CommandName); if (command == null) { throw Err.CommandNotFound(request.CommandName); } await commandRepository.Delete(command.Id); return(new DeleteCommandResponse()); }
public IActionResult DeleteConfirmed(Guid id) { if (Math.Abs(_stocksQueryRepository.GetProductQtty(id)) > double.Epsilon) { return(RedirectToAction(nameof(Index))); } _productsCommandRepository.Delete(id); return(RedirectToAction(nameof(Index))); }
public WriteConcernResult DeletewithConcern <TEntity>(ICommandRepository repository, TEntity entity, WriteConcern writeConcern = null) where TEntity : class { if (repository == null) { throw new ArgumentNullException("repository", "repository is null."); } var interceptor = new WriteConcernDeleteCommandInterceptor(writeConcern ?? new WriteConcern()); repository.Delete(entity, interceptor); return(interceptor.WriteConcernResult); }
public async Task <IHttpActionResult> Delete(string id) { try { await commandRepository.Delete(id); return(Ok()); } catch (Exception) { return(InternalServerError()); } }
public Result <int> Save(PostingItem entity) { switch (entity.EntityState) { case ItemState.Added: return(_commandRepository.Add(entity.MapTo <Postings>()).MapResultTo <int, object>()); case ItemState.Modified: return(_commandRepository.InlineUpdate(entity, entity.Id)); case ItemState.Delete: return(_commandRepository.Delete(entity.Id)); case ItemState.Unchanged: return(Result <int> .Fail <int>("Unchanged Object. Nothing to save")); default: return(Result <int> .Fail <int>("Entity state unknown")); } }
public Result <int> Save(CodeMapperItem entity) { switch (entity.EntityState) { case ItemState.Added: return(_commandRepository.Add(entity.MapTo <CodeMappers>()).MapResultTo <int, object>()); case ItemState.Modified: if (!entity.IsDefault) { return(_commandRepository.InlineUpdate(entity, entity.Id)); } return(ResetDefault().Bind <int>(x => _commandRepository.InlineUpdate(entity, entity.Id))); case ItemState.Delete: return(_commandRepository.Delete(entity.Id)); case ItemState.Unchanged: return(Result <int> .Fail <int>("Unchanged Object. Nothing to save")); default: return(Result <int> .Fail <int>("Entity state unknown")); } }
public void Delete(TEntity item) { ContractUtility.Requires <ArgumentNullException>(item.IsNotNull(), "item cannot be null"); _commandRepository.Delete(item); }
public Task <bool> Delete(Guid id) { _serialCancellation.RemoveSource(id); return(_repo.Delete(id)); }
public virtual bool Delete(TEntity item, Action operationToExecuteBeforeNextOperation = null) { return(InvokeAfterWrappingWithinExceptionHandling(() => _repository.Delete(item, operationToExecuteBeforeNextOperation))); }
public void DeleteUser(Guid userSysId) { _commandRepository.Delete <SysUser>(userSysId); }
public virtual bool Delete(TEntity item, Action operationToExecuteBeforeNextOperation = null) { CheckForObjectAlreadyDisposedOrNot(typeof(CommandDomainService <TEntity>).FullName); return(InvokeAfterWrappingWithinExceptionHandling(() => _repository.Delete(item, operationToExecuteBeforeNextOperation))); }
public virtual void Delete(TEntity entity) { _commandRepository.Delete(entity); }
public async Task DeleteAsync(TKey id, string deletedBy) { _commandRepository.Delete(id, deletedBy); await _commandRepository.SaveAsync(); }
public IActionResult DeleteConfirmed(Guid id) { _stockCommandRepository.Delete(id); return(RedirectToAction(nameof(Index))); }
public void Delete(object key) { _commandRepository.Delete(key); }
public void DeleteTopic(Guid topicSysId) { _commandRepository.Delete <Topic>(topicSysId); }
public Result <int> Delete(int id) => _commandRepository.Delete(id);
private Result <int> DeleteDetail(PostingDetailItem entity) => _commandRepository.Delete(entity.Id);