public async Task <IActionResult> Create([FromBody] CreatePostDto model) { try { if (ModelState.IsValid) { var checkName = await _postServices.IsNameExist(model.Title, model.ProductListTypeID); if (checkName == true) { return(BadRequest("Sorry!, This name already exists on our database. Choose another name")); } var createPost = await _postServices.CreatePost(model); return(StatusCode(201, $"{model.Title} created Successfully.")); } return(BadRequest("Sorry! Your task cannot be completed")); } catch (Exception ex) { return(BadRequest($"{ex.Message}, Error! Your task failed, Please try again")); } }