public ReallyPaidModel(CarServiceDbContext context, IEmailSender emailSender) { _workSheetLogic = new WorkSheetLogic(context); _emailLogic = new EmailLogic(context, emailSender); _userLogic = new UserLogic(context); _companyLogic = new CompanyLogic(context); }
public async Task <IActionResult> OnGetAsync([FromServices] CarServiceDbContext context) { var user = await _userManager.GetUserAsync(User); if (user == null) { return(NotFound($"Unable to load user with ID '{_userManager.GetUserId(User)}'.")); } var userId = await _userManager.GetUserIdAsync(user); var userName = await _userManager.GetUserNameAsync(user); var email = await _userManager.GetEmailAsync(user); var phoneNumber = await _userManager.GetPhoneNumberAsync(user); var name = _userManager.Users.Where(u => u.Id == userId).Select(n => new { n.Name }); Input = new InputModel { Fullname = name.SingleOrDefault().Name, Email = email, PhoneNumber = phoneNumber }; IsEmailConfirmed = await _userManager.IsEmailConfirmedAsync(user); return(Page()); }
public WorkSheetModel(CarServiceDbContext context, IEmailSender emailSender) { _appUserLogic = new UserLogic(context); _appointmentLogic = new AppointmentLogic(context); _calendarLogic = new WorkSheetLogic(context); _workLogic = new WorkLogic(context); _emailLogic = new EmailLogic(context, emailSender); }
public void Initialize() { var options = new DbContextOptionsBuilder <CarServiceDbContext>() .UseInMemoryDatabase(databaseName: "InMemoryDb") .Options; _dbctx = new CarServiceDbContext(options); _repo = new VehicleRepository(_dbctx); }
public static void InitializeOrder(CarServiceDbContext context) { Random random = new Random(); const string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; int ordersCount = 50; int[] autoRiaId = { 21352854, 18660881, 20454797, 20709355, 21280512, 21366060, 19454827, 21148041, 21397834, 21396045 }; string[] markName = { "Volkswagen", "Mitsubishi", "Nissan", "Infiniti", "Suzuki", "Opel", "Kia", "Mercedes-Benz", "Audi" }; string[] modelName = { "Touareg", "Lancer X", "Qashqai", "Q30", "Vitara", "Insignia", "Sportage", "E-Class", "Q5" }; string[] city = { "Kyiv", "Odessa", "Lviv", "Kharkiv", "Poltava", "Pryluky", "Stryi", "Zhmerynka" }; string[] photoLink = { "https://cdn.riastatic.com/photosnew/auto/photo/audi_q5__208448878sx.jpg", "https://cdn.riastatic.com/photosnew/auto/photo/mercedes-benz_e-class__189373766sx.jpg", "https://cdn.riastatic.com/photosnew/auto/photo/kia_sportage__195583415sx.jpg", "https://cdn.riastatic.com/photosnew/auto/photo/opel_insignia__207299768sx.jpg", "https://cdn.riastatic.com/photosnew/auto/photo/opel_corsa__207330356sx.jpg", "https://cdn.riastatic.com/photosnew/auto/photo/suzuki_vitara__208651532sx.jpg", "https://cdn.riastatic.com/photosnew/auto/photo/infiniti_q30__206379767sx.jpg", "https://cdn.riastatic.com/photosnew/auto/photo/nissan_qashqai__205340151sx.jpg", "https://cdn.riastatic.com/photosnew/auto/photo/mitsubishi_lancer-x__209154634sx.jpg", "https://cdn.riastatic.com/photosnew/auto/photo/volkswagen_touareg__209125093sx.jpg" }; if (!context.Orders.Any()) { for (int i = 0; i < ordersCount; i++) { var auto = new Auto { AutoRiaId = random.Next(1000000, 2000000), MarkName = markName[random.Next(0, markName.Length)], ModelName = modelName[random.Next(0, modelName.Length)], Year = random.Next(2000, 2019), City = city[random.Next(0, city.Length)], PhotoLink = photoLink[random.Next(0, photoLink.Length)], TypeId = random.Next(1, 5), MarkId = random.Next(1, 50), ModelId = random.Next(1, 50), }; context.Autos.Add(auto); var order = new Order { CustomerId = random.Next(1, 2), AutoId = auto.Id, Description = ABC.RandomString(random.Next(8, 20)), Date = DateTime.Now.ToUniversalTime() }; context.Orders.Add(order); context.SaveChanges(); } } }
public MainWindow() { InitializeComponent(); using (CarServiceDbContext db = new CarServiceDbContext()) { List <Specialty> specialties = db.Specialties.ToList(); specialties.ForEach(sp => txb.Text += $"{sp.Profession}\n"); //db.Specialties.Add(new Specialty { Profession = "Шиномонтажник" }); //db.SaveChanges(); } }
public static void Main(string[] args) { var db = new CarServiceDbContext(); Database.SetInitializer(new MigrateDatabaseToLatestVersion <CarServiceDbContext, Configuration>()); //var user = new User { Name = "Ivan", Address = "Sofiq", Gender = Gender.Male }; //db.Users.Add(user); db.SaveChanges(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, CarServiceDbContext carServiceDbContext) { if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Home/Error"); } // Seed mock data carServiceDbContext.EnsureSeedDataForContext(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); }
public RegisterModel( UserManager <User> userManager, SignInManager <User> signInManager, ILogger <RegisterModel> logger, IEmailSender emailSender, CarServiceDbContext context) { _userManager = userManager; _signInManager = signInManager; _logger = logger; _emailSender = emailSender; _context = context; SelectListItem client = new SelectListItem { Value = UserType.CLIENT.ToString(), Text = EnumHelper <UserType> .GetDisplayValue(UserType.CLIENT) }; SelectListItem worker = new SelectListItem { Value = UserType.WORKER.ToString(), Text = EnumHelper <UserType> .GetDisplayValue(UserType.WORKER) }; SelectListItem company = new SelectListItem { Value = UserType.COMPANY.ToString(), Text = EnumHelper <UserType> .GetDisplayValue(UserType.COMPANY) }; Options = new List <SelectListItem> { client, worker, company }; }
public ServiceService(CarServiceDbContext context) { _context = context; }
public EmailLogic(CarServiceDbContext carServiceDbContext, IEmailSender emailSender) { _applicationEntityManager = new ApplicationEntityManager(carServiceDbContext); _emailSender = emailSender; }
public ApplicationUserManager(CarServiceDbContext context) { _context = context; }
public VehicleRepository(CarServiceDbContext context) { _ctx = context; }
public IndexModel(CarServiceDbContext context) { _userLogic = new UserLogic(context); _companyLogic = new CompanyLogic(context); }
public EditCarModel(CarServiceDbContext context) { _context = context; }
public CheckMaterialItemService(CarServiceDbContext context) { _context = context; }
public MakeAppointmentModel(CarServiceDbContext context, IEmailSender emailSender) { _appUserManager = new UserLogic(context); _appointmentManager = new AppointmentLogic(context); _emailLogic = new EmailLogic(context, emailSender); }
public CarTypeRepository(CarServiceDbContext context, IMapper mapper) : base(context, mapper) { _context = context; }
public AppointmentLogic(CarServiceDbContext context) { _applicationEntityManager = new ApplicationEntityManager(context); }
public CategoryService(CarServiceDbContext context) { _context = context; }
public ModifyPriceModel(CarServiceDbContext context, IEmailSender emailSender) { _workSheetLogic = new WorkSheetLogic(context); _userLogic = new UserLogic(context); _emailLogic = new EmailLogic(context, emailSender); }
public CheckService(CarServiceDbContext context) { _context = context; }
public OrderDetailRepository(CarServiceDbContext context, IMapper mapper) : base(context, mapper) { _context = context; }
public CompanyLogic(CarServiceDbContext carServiceDbContext) { _applicationEntityManager = new ApplicationEntityManager(carServiceDbContext); }
public DetailsModel(CarServiceDbContext context) { _workLogic = new WorkLogic(context); }
public ClientService(CarServiceDbContext context) { _context = context; }
public WorkSheetLogic(CarServiceDbContext context) { _applicationEntityManager = new ApplicationEntityManager(context); }
public BrowseSubTaskModel(CarServiceDbContext context, UserManager <User> userManager) { _userManager = userManager; _context = context; }
public ApplicationEntityManager(CarServiceDbContext context) { _context = context; }
public AddCarModel(CarServiceDbContext context, UserManager <User> userManager) { _context = context; _userManager = userManager; }