private Result <int> Save(ActionCodeItem entity, long latestCode, int fieldCode) { if (latestCode >= fieldCode) { latestCode = latestCode + 1; } else { latestCode = fieldCode; } entity.Code = latestCode.MapTo <int>(); return(_repository.Add(entity)); }
public Result <int> Add(ActionCodeItem entity) { var fieldCode = 0; if (entity.IsFee) { fieldCode = 10000; } if (entity.IsAsset) { fieldCode = 50000; } if (entity.IsEquity) { fieldCode = 90050; } if (entity.IsLiability) { fieldCode = 30000; } return(_repository.GetLastCode(fieldCode).Bind(result => Save(entity, result, fieldCode))); }
public Result <int> Add(ActionCodeItem entity) => _commandRepository.Add(entity.MapTo <ActionCodes>()).MapResultTo <int, object>();
public Result <ActionCodeItem> Put(int id, [FromBody] ActionCodeItem value) { return(_repositoryCommand.Update(id, value)); }
public Result <int> Post([FromBody] ActionCodeItem value) { return(_services.Add(value)); }