public Yield PostPageRating(DreamContext context, DreamMessage request, Result <DreamMessage> response) { UserBE user = DekiContext.Current.User; if (UserBL.IsAnonymous(user)) { throw new RatingForAnonymousDeniedException(AUTHREALM, string.Empty); } PageBE page = PageBL_AuthorizePage(context, user, Permissions.READ, false); string scoreStr = context.GetParam("score"); float? score = null; if (!string.IsNullOrEmpty(scoreStr)) { float tempScore; if (!float.TryParse(scoreStr, out tempScore)) { throw new RatingInvalidArgumentException(); } score = tempScore; } RatingBL.SetRating(page, user, score); XDoc ret = RatingBL.GetRatingXml(page, user); response.Return(DreamMessage.Ok(ret)); yield break; }
public Yield GetPageRating(DreamContext context, DreamMessage request, Result <DreamMessage> response) { UserBE user = DekiContext.Current.User; PageBE page = PageBL_AuthorizePage(context, user, Permissions.READ, false); XDoc ret = RatingBL.GetRatingXml(page, user); response.Return(DreamMessage.Ok(ret)); yield break; }