[HttpPost]
public async Task<IActionResult> CreateChat([FromBody] CreateChatDto chat)
{
_db.Chats.Add(new Chat
{
AuthorId = (int)chat.AuthorId!,
Title = chat.Title
});
await _db.SaveChangesAsync();
return Ok("Chat successfully created");
}
[HttpPost]
public async Task<IActionResult> CreateChat([FromBody] CreateChatDto chat)
{
_db.Chats.Add(new Chat
{
AuthorId = (int)chat.AuthorId!,
Title = chat.Title
});
await _db.SaveChangesAsync();
return Ok("Chat successfully created");
}