private void InstallPictures(Model.Models.BeYourMarketContext context) { for (int i = 1; i <= 9; i++) { context.Pictures.Add(new Model.Models.Picture() { MimeType = "image/jpeg", ObjectState = Repository.Pattern.Infrastructure.ObjectState.Added }); context.SaveChanges(); context.ListingPictures.Add(new Model.Models.ListingPicture() { ListingID = i, PictureID = i, ObjectState = Repository.Pattern.Infrastructure.ObjectState.Added }); // Copy files var pathFrom = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/images/sample/listing"), string.Format("{0}.{1}", i.ToString("00000000"), "jpg")); var pathTo = Path.Combine(System.Web.HttpContext.Current.Server.MapPath("~/images/listing"), string.Format("{0}.{1}", i.ToString("00000000"), "jpg")); File.Copy(pathFrom, pathTo, true); } }
private void InstallListingTypes(Model.Models.BeYourMarketContext context) { context.ListingTypes.Add(new BeYourMarket.Model.Models.ListingType() { Name = "Offer", ButtonLabel = "Book", OrderTypeID = (int)Enum_ListingOrderType.DateRange, OrderTypeLabel = "Number of days", PriceUnitLabel = "Per day", PaymentEnabled = true, ShippingEnabled = false, ObjectState = Repository.Pattern.Infrastructure.ObjectState.Added }); context.SaveChanges(); }
public async Task <ActionResult> Install(InstallModel model) { System.Data.Entity.Database.SetInitializer(new BeYourMarketDatabaseInitializer(model)); // initialize and create database using (var context = new Model.Models.BeYourMarketContext()) { context.Database.Initialize(true); context.SaveChanges(); } // Sign in user var user = UserManager.FindByEmail(model.Email); await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); InstallPlugins(); return(RedirectToAction("Index", "Home", new { area = "" })); }
public async Task<ActionResult> Install(InstallModel model) { System.Data.Entity.Database.SetInitializer(new BeYourMarketDatabaseInitializer(model)); // initialize and create database using (var context = new Model.Models.BeYourMarketContext()) { context.Database.Initialize(true); context.SaveChanges(); } // Sign in user var user = UserManager.FindByEmail(model.Email); await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false); return RedirectToAction("Index", "Home", new { area = "" }); }