public async Task <BaseApiResponse> Add(AddThirdCurrencyRequest request)
        {
            request.CheckNotNull(nameof(request));

            var newthirdcurrencyid = GuidUtil.NewSequentialId();
            var command            = new CreateThirdCurrencyCommand(
                newthirdcurrencyid,
                request.Name,
                request.Icon,
                request.CompanyName,
                request.Conversion,
                request.IsLocked,
                request.Remark
                );
            var result = await ExecuteCommandAsync(command);

            if (!result.IsSuccess())
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage())
                });
            }
            //添加操作记录
            var currentAdmin = _contextService.GetCurrentAdmin(HttpContext.Current);

            RecordOperat(currentAdmin.AdminId.ToGuid(), "添加外币", newthirdcurrencyid, request.Name);
            return(new BaseApiResponse());
        }
Beispiel #2
0
        public async Task <BaseApiResponse> Add([FromBody] AddThirdCurrencyRequest request)
        {
            request.CheckNotNull(nameof(request));

            var command = new CreateThirdCurrencyCommand(
                GuidUtil.NewSequentialId(),
                request.Name,
                request.Icon,
                request.CompanyName,
                request.Conversion,
                request.IsLocked,
                request.Remark
                );
            var result = await ExecuteCommandAsync(command);

            if (!result.IsSuccess())
            {
                return(new BaseApiResponse {
                    Code = 400, Message = "命令没有执行成功:{0}".FormatWith(result.GetErrorMessage())
                });
            }
            return(new BaseApiResponse());
        }