public ActionResult AddComment(AddCommentViewModel model) { int userId = accountService.GetUserByLogin(User.Identity.Name).Id; photoService.AddComment(model.ToBllComment(userId, User.Identity.Name)); return(RedirectToAction("LoadMoreComment", new { page = 0, id = model.PhotoId })); }
public ActionResult AddComment(int id, Comment model) { var photo = _photoService.GetPhotoById(id); model.User = GetCurrentLoggedUser().Result; model.UserId = GetCurrentLoggedUser().Result.Id; if (photo != null) { _photoService.AddComment(photo, model); return(Ok()); } return(NotFound()); }