private FileMessageBindingModel MakeFileMessageBindingModel(FileMessageDto dto) { FileMessageBindingModel model = new FileMessageBindingModel(); model.fileName = dto.fileName; model.filePath = dto.filePath; return(model); }
private FileMessageDto MakeFileMessageDto(FileMessageBindingModel model) { FileMessageDto dto = new FileMessageDto(); dto.fileName = model.fileName; dto.filePath = model.filePath; return(dto); }
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)); } }