public ICrudManager ProcessSave <DOMAINMODEL>(DOMAINMODEL model, ICrudManager crudManager = null) where DOMAINMODEL : DomainEntity { if (crudManager == null) { crudManager = new CrudManager(_repository); } var report = _castleValidationRunner.Validate(model); if (report.Success) { _repository.Save(model); //report.Target = model; } crudManager.AddCrudReport(report); return(crudManager); }
public ICrudManager DecrementTaskProduct(Task task, ICrudManager crudManager = null) { if (crudManager == null) { crudManager = new CrudManager(_repository); } if (task.InventoryProduct == null) { return(crudManager); } if (!task.QuantityUsed.HasValue) { var crudReport = new CrudReport { Success = false }; crudReport.AddErrorInfo(new ErrorInfo("QuantityUsed", CoreLocalizationKeys.QUANTITY_USED_REQUIRED.ToString())); crudManager.AddCrudReport(crudReport); return(crudManager); } task.InventoryProduct.Quantity -= task.QuantityUsed.Value; return(_saveEntityService.ProcessSave(task.InventoryProduct, crudManager)); }