public void AddOrder_NullRequest_NoException() { Assert.DoesNotThrow(() => postsManager.AddPost(new Post(connStr) { user = new User() })); }
public HttpResponseMessage AddPost(Post post, string lang) { if (string.IsNullOrWhiteSpace(post.Content)) { return(Request.CreateResponse(HttpStatusCode.OK)); } if (!postsManager.AddPost(User.Identity.Name, post.Content)) { var error = Resources.Errors.ResourceManager.GetString("PostNotAdded", CultureInfo.GetCultureInfo(lang)); return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, error)); } return(Request.CreateResponse(HttpStatusCode.OK)); }
public async Task <IHttpActionResult> AddPost(DTOPost post) { var result = await _postsManager.AddPost(post); return(Ok(result)); }