Exemple #1
0
        public void RemoveNomination(int nominationId)
        {
            var nomination = Nominations.FirstOrDefault(n => n.Id == nominationId);

            if (nomination == null)
            {
                throw new ArgumentException(nameof(nominationId));
            }

            var removed = _nominations.Remove(nomination);

            if (!removed)
            {
                return;
            }

            SetNomineeIdentifiers();

            MarkAsDirty(
                $@"Removed {nomination.NominatorName.RawNameText}'s nomination for {nomination.NomineeName.FullName}");

            if (!GetNominationsForNominee(nomination.AwardType, nomination.Nominee).Any())
            {
                UnselectAwardWinner(nomination.AwardType, nomination.Nominee);
            }
        }
Exemple #2
0
        public void UpdateNominationWriteUp(int nominationId, NominationWriteUp newWriteUp)
        {
            if (newWriteUp == null)
            {
                throw new ArgumentNullException(nameof(newWriteUp));
            }
            if (!newWriteUp.IsValid)
            {
                throw new ArgumentException(nameof(newWriteUp));
            }

            var nomination = Nominations.FirstOrDefault(n => n.Id == nominationId);

            if (nomination == null)
            {
                throw new ArgumentException(nameof(nominationId));
            }

            nomination.UpdateWriteUp(newWriteUp);
            MarkAsDirty($@"Updated a nomination write-up for {nomination.NomineeName}");
        }