Ejemplo n.º 1
0
        public async Task <ActionResult> AddComment(CommentInsertViewModel comment)
        {
            comment.CreatorId = long.Parse(User.Identity.GetUserId());
            comment.Ip        = Network.GetClientIp();
            await _commentService.Create(comment);

            return(PartialView("AddCommentSuccessfully"));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> Create(CommentInsertViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                viewModel.CreatorId = long.Parse(User.Identity.GetUserId());
                await _commentService.Create(viewModel);

                ViewBag.Message = "مخاطب جدید با موفقیت ثبت شد.";
                return(RedirectToAction("Index"));
            }
            ViewBag.Message = "ثبت انجام نشد.";
            return(View(viewModel));
        }
Ejemplo n.º 3
0
 public async Task Create(CommentInsertViewModel viewModel)
 {
     _comment.Add(_mappingEngine.Map <Comment>(viewModel));
     await _unitOfWork.SaveChangesAsync();
 }