Пример #1
0
        public virtual ActionResult Award(string id, UserAwardViewModel model)
        {
            var award = Awards[id];

            var ua = model.CreateAward(CurrentUser, award);

            if (ua.Amount.HasValue)
            {
                Accounting.CreateProgramAward(
                    award,
                    CurrentUser,
                    Users[ua.Recipient],
                    ua.Amount.Value,
                    award.Content.Title
                    );
            }
            UserAwards.Save(ua);
            Messaging.SendAward(ControllerContext.RequestContext, ua);

            return(Index());
        }
 protected Transaction TryAwardPoints(int points)
 {
     try
     {
         return
             (Accounting.CreateProgramAward(
                  CurrentResource,
                  null,
                  CurrentUser,
                  points,
                  CurrentResource.Content.Title
                  ));
     }
     catch (Exception)
     {
         Notifier.Notify(
             Severity.Error,
             "We couldn't award your points.", "We're sorry, but there was configuration problem with this program. Please contact technical support so that the issue can be resolved.",
             CurrentResource);
     }
     return(null);
 }