Example #1
0
 public JsonResult New(NewRatingViewModel model)
 {
     if (ModelState.IsValid)
     {
         var opinion = new Opinion()
         {
             Comment = model.RateComment, ObjectID = model.RateObjectID, Rating = model.RateScore
         };
         ctnSvc.CreateOpinion(opinion, model.RateObjectID);
         return(Json(opinion));
     }
     else
     {
         return(Json(new { Success = false }));
     }
 }
Example #2
0
        public ActionResult New(Guid id)
        {
            if (!CfIdentity.IsAuthenticated)
            {
                return(PartialView("NewLogin"));
            }

            var model = new NewRatingViewModel()
            {
                RateObjectID = id
            };

            var existing = ctnSvc.GetOpinion(id, CfIdentity.UserID);

            if (existing != default(Opinion))
            {
                model.RateScore   = existing.Rating;
                model.RateComment = existing.Comment;
            }

            return(PartialView(model));
        }