public BaseResponse Operation(OperationAccount request) { Operation operation = new Operation(); if (request.Hash == "") { return new BaseResponse() { StatusCode = 400, Message = "Hash is empty" } } ; Account account = _repositoryAccount.GetHash(request.Hash); if (request.Type == "D") { operation.Type = request.Type; operation.Value = request.Value; operation.DateTime = DateTime.Now; operation.AccountDestinyId = account.Id; } if (request.Type == "S") { operation.Type = request.Type; operation.Value = request.Value; operation.DateTime = DateTime.Now; operation.AccountRootId = account.Id; } int id = _repository.Insert(operation); var result = Get(id); result.Message = "Operation was created."; result.StatusCode = StatusCodes.Status201Created; return(result); }