Blog.Web.Api.Controllers.CommunityController.Post C# (CSharp) Method

Post() private method

private Post ( [ community ) : IHttpActionResult
community [
return IHttpActionResult
        public IHttpActionResult Post([FromBody]Community community)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return BadRequest(ModelState);
                }

                return Ok(_communityResource.Add(community));
            }
            catch (Exception ex)
            {
                _errorSignaler.SignalFromCurrentContext(ex);
                var errorResult = new Community
                {
                    Error = new Error
                    {
                        Id = (int)Common.Utils.Constants.Error.InternalError,
                        Message = ex.Message
                    }
                };
                return Ok(errorResult);
            }
        }