public IEnumerable <Shelter.Shared.Shelters> GetShelters() { using (var _context = new ShelterContext()){ return(_context.Shelters .Include(x => x.Animals) .ToList()); } }
public AnimalController GetController() { dbContextOptions = new DbContextOptionsBuilder <ShelterContext>().UseMySql(connectionString).Options; var context = new ShelterContext(dbContextOptions); controller = new AnimalController(context); DBInitializer db = new DBInitializer(); db.Seed(context); return(controller); }
public ActionResult Authorize(Employee userModel) { using (ShelterContext db = new ShelterContext()) { var userDetails = db.Employees.Where(x => x.Login == userModel.Login && x.Password == userModel.Password).FirstOrDefault(); if (userDetails == null) { userModel.LoginErrorMessage = "Wrong username or password."; return(View("Login", userModel)); } else { Session["login"] = userDetails.Login; return(RedirectToAction("Index", "Pets")); } } }
public void Seed(ShelterContext context) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); context.Animal.AddRange( new Animal() { Age = 2, Weight = 10, Size = 8, Name = "puszek", Added = new DateTime(2019, 5, 9, 9, 32, 52), Strain = "pies" }, new Animal() { Age = 6, Weight = 11, Size = 3, Name = "burek", Added = new DateTime(2017, 7, 15, 6, 39, 52), Strain = "pies" }, new Animal() { Age = 4, Weight = 18, Size = 2, Name = "azor", Added = new DateTime(2018, 12, 15, 15, 10, 52), Strain = "pies" }, new Animal() { Age = 9, Weight = 5, Size = 7, Name = "mysia", Added = new DateTime(2019, 11, 8, 9, 20, 52), Strain = "chomik" }, new Animal() { Age = 2, Weight = 9, Size = 4, Name = "riko", Added = new DateTime(2018, 10, 21, 21, 50, 52), Strain = "kot" }, new Animal() { Age = 2, Weight = 6, Size = 2, Name = "miki", Added = new DateTime(2019, 11, 8, 6, 7, 52), Strain = "kot" }, new Animal() { Age = 12, Weight = 1, Size = 3, Name = "burek", Added = new DateTime(2017, 6, 9, 11, 12, 52), Strain = "pies" }, new Animal() { Age = 4, Weight = 10, Size = 10, Name = "dino", Added = new DateTime(2019, 3, 2, 8, 30, 52), Strain = "papuga" } ); context.SaveChanges(); }
protected void Seed(ShelterContext shelterContext) { shelterContext.Roles.Add( new Roles { RoleID = 1, RoleName = "Client" }); shelterContext.Roles.Add( new Roles { RoleID = 2, RoleName = "Volunteer" }); shelterContext.Roles.Add( new Roles { RoleID = 3, RoleName = "Employee" }); shelterContext.Roles.Add( new Roles { RoleID = 4, RoleName = "Administrator" }); /*roles.RoleName = "Client"; * roles.RoleName = "Volunteer"; * roles.RoleName = "Employee"; * roles.RoleName = "Administrator";*/ }
public DetailsController(ShelterContext db) { -db = db; }
public CatsController(ShelterContext db) { _db = db; }
public ShelterDataAccess(ShelterContext context) { _context = context; }
public IndexModel(ShelterContext context) { _context = context; }
public AnimalRacesController(ShelterContext context) : base(context) { _context = context; }
public IEnumerable <Animal> GetAnimals() { using (var _context = new ShelterContext()){ return(_context.Animals.ToList()); } }
public Animal GetAnimal(int id) { using (var _context = new ShelterContext()){ return(_context.Animals.SingleOrDefault(a => a.Id == id)); } }
public SheltersController(ShelterContext context) { _context = context; }
public DonationsController(ShelterContext context) : base(context) { _context = context; }
public ContractsController(ShelterContext context) { _context = context; }
public ShelterEmployeesController(ShelterContext context) { _context = context; }
public AppointmentsController(ShelterContext context) { _context = context; }
public DogsController(ShelterContext db) { _db = db; }
public RequestsController(ShelterContext context) { _context = context; }
public StatisticsController(ShelterContext context) : base(context) { _context = context; }
public PetsController() { _context = new ShelterContext(); }
public AnimalsController(ShelterContext context, IHostingEnvironment environment) : base(context) { _context = context; hostingEnvironment = environment; }
public UsersController(ShelterContext context, IConfiguration configuration) : base(context) { _context = context; _configuration = configuration; }
public CatchServiceEmployeesController(ShelterContext context) { _context = context; }
public AuthDatasController(ShelterContext context) { _context = context; }
public RolesController(ShelterContext context) : base(context) { _context = context; }
public AnimalsController(ShelterContext context) { _context = context; }
public AnimalController(ShelterContext db) { _db = db; }
public ProductTypesController(ShelterContext context) : base(context) { _context = context; }
public ShelterDataAccess(ShelterContext db) { _context = db; }