Example #1
0
        public async Task <IActionResult> AddPost([FromForm] AddPostModel model)
        {
            var session = HttpContext.Session;
            var userId  = session.GetString(CommonConstants.USER_SESSION);

            if (userId == null)
            {
                return(Unauthorized());
            }
            model.UserId = Convert.ToInt64(userId);
            var result = await postService.AddPostForMod(model);

            if (result == null)
            {
                return(BadRequest());
            }
            return(Ok(result));
        }