public async Task <IActionResult> AddMessageToUser(string username, CreateMessageModel model) { try { await _timelineService.CreateMessage(model, username); } catch (UnknownUserException e) { return(BadRequest(new ErrorResponse(e))); } return(NoContent()); }
public async Task <IActionResult> AddMessage(CreateMessageModel model) { try { await _timelineService.CreateMessage(model, User.GetUserID()); } catch (UnknownUserException e) { return(BadRequest(new ErrorResponse(e))); } ViewData["messages"] = new List <string> { "Your message was recorded" }; return(RedirectToAction(nameof(Timeline))); }