Пример #1
0
        /// <summary>Save the typo to the database.</summary>
        public void Save()
        {
            var typoRepository = new RelationalRepository <TypoRecord>();

            var typoRecord = new TypoRecord
            {
                ID                  = this.Id,
                Note                = this.Note,
                Resolved            = this.Resolved,
                ResolvedByPlayerID  = (long)this.ResolvedByPlayerId,
                RoomID              = Convert.ToInt64(this.PlaceID),
                SubmittedByPlayerID = Convert.ToInt64(this.SubmittedByPlayerID),
            };

            if (this.ResolvedDateTime != null)
            {
                typoRecord.ResolvedDateTime = this.ResolvedDateTime.ToString();
            }
            else
            {
                typoRecord.ResolvedDateTime = null;
            }

            typoRecord.SubmittedDateTime = this.SubmittedDateTime.ToString(CultureInfo.InvariantCulture);

            if (typoRecord.ID == 0)
            {
                typoRepository.Add(typoRecord);
                this.Id = typoRecord.ID;
            }
            else
            {
                typoRepository.Update(typoRecord);
            }
        }