Exemplo n.º 1
0
 public StolenGearViewModel(StolenGear input)
 {
     if (input.ImageNames.Length != 5 ||
         input.ImageCaptions.Length != 5)
         throw new ArgumentOutOfRangeException();
     Id = input.Id;
     Headline = input.Headline;
     WhatIsIt = input.WhatIsIt;
     WhereWasItStolenFrom = input.WhereWasItStolenFrom;
     WhoToContact = input.WhoToContact;
     ContactEmail = input.ContactEmail;
     ContactPhone = input.ContactPhone;
     RewardOfferedIs = input.RewardOfferedIs;
     WhenWasItStolen = input.WhenWasItStolen;
     Recovered = input.Recovered;
     Archived = input.Archived;
     Created = input.Created;
     Edited = input.Edited;
     ImageCaption1 = input.ImageCaptions[0];
     ImageCaption2 = input.ImageCaptions[1];
     ImageCaption3 = input.ImageCaptions[2];
     ImageCaption4 = input.ImageCaptions[3];
     ImageCaption5 = input.ImageCaptions[4];
     ImageName1 = input.ImageNames[0];
     ImageName2 = input.ImageNames[1];
     ImageName3 = input.ImageNames[2];
     ImageName4 = input.ImageNames[3];
     ImageName5 = input.ImageNames[4];
 }
Exemplo n.º 2
0
 public StolenGear Save(StolenGear input, params HttpPostedFileBase[] images)
 {
     imagerer.Save(images, input.ImageNames, input.Headline.Tidy());
     session.Store(input);
     session.SaveChanges();
     return input;
 }