public OperationResultVo EnterGiveaway(Guid currentUserId, GiveawayEnterViewModel vm, string urlReferralBase) { try { string myCode = Guid.NewGuid().NoHyphen(); DomainOperationVo <GiveawayParticipant> domainActionPerformed = giveawayDomainService.AddParticipant(vm.GiveawayId, vm.Email, vm.GdprConsent, vm.WantNotifications, myCode, vm.ReferralCode, vm.EntryType); unitOfWork.Commit(); if (domainActionPerformed.Action == DomainActionPerformed.Create) { string urlReferral = string.Format("{0}?referralCode={1}", urlReferralBase, myCode); string shortUrl = shortUrlDomainService.Add(urlReferral, ShortUrlDestinationType.Giveaway); if (!string.IsNullOrWhiteSpace(shortUrl)) { giveawayDomainService.UpdateParticipantShortUrl(vm.GiveawayId, vm.Email, shortUrl); unitOfWork.Commit(); } return(new OperationResultVo <string>(myCode, 0, "You are in!")); } return(new OperationResultVo <string>(string.Empty, 0, "You are in!")); } catch (Exception ex) { return(new OperationResultVo(ex.Message)); } }
public OperationResultVo DailyEntry(Guid currentUserId, Guid giveawayId, Guid participantId) { try { DomainOperationVo <int> domainOperation = giveawayDomainService.DailyEntry(giveawayId, participantId); if (domainOperation.Action == DomainActionPerformed.None) { return(new OperationResultVo(false, "You already have one entry for today!<br>Come back tomorrow for more!")); } unitOfWork.Commit(); return(new OperationResultVo <int>(domainOperation.Entity, "You got one more entry for today!<br>Come back tomorrow for more!")); } catch (Exception ex) { return(new OperationResultVo(ex.Message)); } }
public OperationResultVo Rate(Guid currentUserId, Guid id, decimal scoreDecimal) { try { DomainOperationVo <UserContentRating> domainActionPerformed = userContentDomainService.Rate(currentUserId, id, scoreDecimal); unitOfWork.Commit(); if (domainActionPerformed.Action == DomainActionPerformed.Update) { return(new OperationResultVo(true, "Your rate was updated!")); } else { return(new OperationResultVo(true, "Comics rated!")); } } catch (Exception ex) { return(new OperationResultVo(ex.Message)); } }