/// <summary>
        /// Save the new uploaded file to db
        /// </summary>
        public override async Task <gFileItemResponse> SaveFile(gFileItemRequest request, ServerCallContext context)
        {
            var file       = request.FileItem.Convert();
            var saveResult = await _mediatr.Send(new SaveFileCommand(file));

            return(new gFileItemResponse()
            {
                FileItem = saveResult.File.Convert(),
                Status = saveResult.Convert()
            });
        }
Beispiel #2
0
        /// <summary>
        /// Save the new uploaded file to db
        /// </summary>
        public override async Task <gFileItemResponse> SaveFile(gFileItemRequest request, ServerCallContext context)
        {
            var response = new gFileItemResponse();
            var result   = await _mediatr.Send(new SaveFileCommand(request.FileItem.Convert()));

            response.Status = result.Convert();
            if (result.State == OperationState.Success)
            {
                response.FileItem = result.File.Convert();
            }

            return(response);
        }
Beispiel #3
0
        public override async Task <gFileItemResponse> SaveFile(gFileItemRequest request, ServerCallContext context)
        {
            var file = request.FileItem.Convert();

            file.UserId = context.GetHttpContext().User.Claims.FirstOrDefault(c => c.Type == "id").Value;

            var saveResult = await _mediatr.Send(new SaveFileCommand(file));

            return(new gFileItemResponse()
            {
                FileItem = saveResult.File.Convert(),
                Status = saveResult.Convert()
            });
        }