public void Create(CreateAnnouncement request) { var requestToSend = new RestRequest($"/topics/{request.TopicName}/announcements", Method.POST); requestToSend.AddParameter("Content", request.Content); processRequest(request.TopicName, requestToSend); }
public object Post(CreateAnnouncement request) { try { CreatingAnnouncement.Create(request); } catch (TopicNotExistsException) { return(new HttpError(HttpStatusCode.NotFound, $"Topic {request.TopicName} not exists")); } catch (BadRequestException) { return(new HttpError(HttpStatusCode.BadRequest, "BadRequest")); } return(new HttpResult(new CreateAnnouncementResponse(), HttpStatusCode.Created)); }