Exemplo n.º 1
0
        public async Task <IActionResult> Edit([FromBody] Topic payload)
        {
            var topic = _topicService.FindById(payload.Id);

            if (topic == null)
            {
                return(BadRequest());
            }

            topic.Name        = payload.Name;
            topic.Description = payload.Description;

            await _unitOfWork.SaveChangesAsync();

            return(Ok());
        }
Exemplo n.º 2
0
        public ActionResult Create(int idTopic, post post)
        {
            post.user     = CurrentUser.get();
            post.topic    = t.FindById(idTopic);
            post.postDate = DateTime.Now;
            p.Create(post);
            p.Commit();

            return(RedirectToAction("Index", new { idTopic = post.idTopic }));
        }