Example #1
0
 public AboutUpdateModel MapToAboutUpdateModel(Band entity)
 {
     return new AboutUpdateModel
                {
                    DateFounded = entity.Founded.ToLocalTime(),
                    Info = entity.Description ?? string.Empty,
                };
 }
Example #2
0
 public AboutModel MapToAboutModel(Band entity)
 {
     return new AboutModel
                {
                    DateFounded = entity.Founded.ToLocalTime(),
                    Info = entity.Description == null
                               ? string.Empty
                               : entity.Description.Replace(Environment.NewLine, "<br />"),
                };
 }
Example #3
0
        public static Band CreateSingle()
        {
            var entity = new Band
                             {
                                 Founded = DateTime.UtcNow.AddYears(-1),
                                 ModificationDate = DateTime.UtcNow.AddMonths(-1),
                             };

            entity.Name = string.Format(CultureInfo.InvariantCulture, "Name {0}", entity.Id);
            entity.InitVector = string.Format(CultureInfo.InvariantCulture, "InitVector {0}", entity.Id).PadRight(16).Substring(0, 16);
            entity.Passphrase = string.Format(CultureInfo.InvariantCulture, "PassPhrase {0}", entity.Id);
            entity.SaltValue = string.Format(CultureInfo.InvariantCulture, "SaltValue {0}", entity.Id);
            entity.Description = string.Format(CultureInfo.InvariantCulture, "Description {0}", entity.Id);

            return entity;
        }
Example #4
0
        public Band EnsureBandExists()
        {
            var bands = AppRepository.GetAllBands();

            var band =  bands.SingleOrDefault();
            if (band == null)
            {
                var cryptographyProcess = CatalogsConsumerHelper.ResolveCatalogsConsumer<ICryptographyProcess>(CatalogsContainer);

                band = new Band
                           {
                               InitVector = cryptographyProcess.GenerateSecureRandomNumber(16),
                               Passphrase = cryptographyProcess.GenerateSecureRandomNumber(32),
                               SaltValue = cryptographyProcess.GenerateSecureRandomNumber(16),
                           };

                AppRepository.AddBand(band);
            }

            return band;
        }
Example #5
0
        public Band AddBand(Band band)
        {
            if (band == null) throw new ArgumentNullException("band");

            return _catalogsContainer.AppCatalog.Add(band);
        }
Example #6
0
        public Band UpdateBand(Band band)
        {
            if (band == null) throw new ArgumentNullException("band");

            return AppRepository.UpdateBand(band);
        }