Exemplo n.º 1
0
        public void AddComents(ComentsViewModel coments)
        {
            Coments c = new Coments();

            c.Description   = coments.Description;
            c.PostsID       = coments.PostsID;
            c.AspNetUsersId = coments.AspNetUsersId;
            _internalUnitOfWork.ComentsRespository.Insert(c);
            _internalUnitOfWork.Save();
        }
Exemplo n.º 2
0
 public ActionResult AddComment(int id)
 {
     try
     {
         var comentViewModel = new ComentsViewModel()
         {
             PostsID       = id,
             AspNetUsersId = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value,
             UserName      = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.Name).Value
         };
         return(PartialView(comentViewModel));
     }
     catch (Exception e)
     {
         Debug.WriteLine(e);
         throw;
         //
     }
 }
Exemplo n.º 3
0
        public ActionResult AddComment(ComentsViewModel comentsM)
        {
            try
            {
                // TODO: Add insert logic here

                Debug.WriteLine(comentsM.AspNetUsersId);


                _comentService.AddComents(comentsM);

                return(RedirectToAction("Index", "Posts"));
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                return(View());
            }
        }