Пример #1
0
 public ActionResult AddComment(BusinessComment comment)
 {
     if (comment != null)
     {
         //var user = userService.GetUserByUserName(User.Identity.Name);
         var userId = User.Identity.GetUserId();
         if (!string.IsNullOrEmpty(userId))
         {
             comment.Id = Guid.NewGuid();
             comment.CreateDate = String.Format("{0:dddd, MMMM d, yyyy HH:mm:ss}", DateTime.Now);
             comment.UserId = userId;
             businessCommmentService.Add(comment);
             return Json(true, JsonRequestBehavior.AllowGet);
         }
     }
     return Json(false, JsonRequestBehavior.AllowGet);
 }
Пример #2
0
 private BusinessCommentViewModel CreateBusinessComment(BusinessComment a)
 {
     return new BusinessCommentViewModel()
                       {
                           Comment = new BusinessComment()
                           {
                               Id = a.Id,
                               BusinessId = a.BusinessId,
                               UserId = a.UserId,
                               BusinessRate = a.BusinessRate,
                               Comment = a.Comment,
                               CreateDate = a.CreateDate
                           },
                           User = new User()
                           {
                               FirstName = a.User.FirstName,
                               LastName = a.User.LastName,
                               Id = a.UserId.ToString(),
                               ProfileImage = a.User.ProfileImage
                           }
                       };
 }