public ExecutionResult <TModel> ExecuteCreate <TModel>(TModel model) where TModel : class { var validator = ModelValidationMappings.GetValidationMapping <TModel>(); var isValid = validator.ValidateCreate(model); if (!isValid) { return(ExecutionResult <TModel> .Fail(validator.GetErrors())); } var result = _context.Set <TModel>().Add(model); return(ExecutionResult <TModel> .Success(result.Entity)); }
public void Add(TEntity entity) { _dbContext.Set <TEntity>().Add(entity); }