Esempio n. 1
0
 public ActionResult Create(ReplyViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return(View(model));
     }
     _replyService.CreateReply(model);
     return(RedirectToAction("Index", "Post"));
 }
        public async Task <IHttpActionResult> CreateReply(ReplyCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            ReplyService service = CreateReplyService();

            if (!await service.CreateReply(model))
            {
                return(InternalServerError());
            }
            return(Ok());
        }
Esempio n. 3
0
        //CRUD METHODS

        //========CREATE========//

        //POST
        public IHttpActionResult Post(CreateReply comment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            //instantitate service
            ReplyService service = CreateReplyService();

            if (!service.CreateReply(comment))
            {
                return(InternalServerError());
            }

            return(Ok());
        }