public void AddOrder_NullRequest_NoException()
 {
     Assert.DoesNotThrow(() => postsManager.AddPost(new Post(connStr)
     {
         user = new User()
     }));
 }
예제 #2
0
        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));
        }
예제 #3
0
        public async Task <IHttpActionResult> AddPost(DTOPost post)
        {
            var result = await _postsManager.AddPost(post);

            return(Ok(result));
        }