示例#1
0
        private FileMessageBindingModel MakeFileMessageBindingModel(FileMessageDto dto)
        {
            FileMessageBindingModel model = new FileMessageBindingModel();

            model.fileName = dto.fileName;
            model.filePath = dto.filePath;

            return(model);
        }
示例#2
0
        private FileMessageDto MakeFileMessageDto(FileMessageBindingModel model)
        {
            FileMessageDto dto = new FileMessageDto();

            dto.fileName = model.fileName;
            dto.filePath = model.filePath;

            return(dto);
        }
示例#3
0
        public IActionResult PostFileMessage([FromBody] FileMessageBindingModel message)
        {
            try{
                if (message == null)
                {
                    return(BadRequest());
                }

                FileMessageDto dto = MakeFileMessageDto(message);

                FileMessengerModel messenger = new FileMessengerModel(message.fileName, message.filePath, message.content);

                bool result = messenger.WriteContent();

                return(Ok(result));
            }
            catch {
                return(StatusCode(500));
            }
        }