Example #1
0
        public void AddRecord(RecordViewModel record)
        {
            record.Id         = record.Id == Guid.Empty ? Guid.NewGuid() : record.Id;
            record.CreateDate = record.CreateDate == DateTime.MinValue ? DateTime.Now : record.CreateDate;
            record.Title      = record.Title.IsEmpty() ? "Новая запись" : record.Title;
            record.Type       = record.Type.IsEmpty() ? "text" : record.Type;
            record.Order      = record.Order == 0
                           ? (_storageDb.GetCategoryRecordsCount(record.CategoryId) + 1)
                           : record.Order;

            _storageDb.AddRecord(record);
        }