Example #1
0
 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));
 }
Example #2
0
        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)));
        }
Example #3
0
 public Result <int> Add(ActionCodeItem entity) => _commandRepository.Add(entity.MapTo <ActionCodes>()).MapResultTo <int, object>();
Example #4
0
 public Result <ActionCodeItem> Put(int id, [FromBody] ActionCodeItem value)
 {
     return(_repositoryCommand.Update(id, value));
 }
Example #5
0
 public Result <int> Post([FromBody] ActionCodeItem value)
 {
     return(_services.Add(value));
 }