public JsonResult Rate(double score, int photoId) { try { var rating = new Rating { Score = score, PhotoId = photoId, UserId = CurrentUser.Id }; var newRating = _ratingManager.Submit(rating); return(new JsonResult { Data = new { Success = true, Rating = newRating } }); } catch (Exception e) { return(new JsonResult { Data = new { Success = false } }); } }