public ActionResult Index() { VolunteerContext volunteerContext = new VolunteerContext(); List <Volunteer> volunteers = volunteerContext.Volunteers.ToList(); return(View(volunteers)); }
public ActionResult Details(int Id) { VolunteerContext volunteerContext = new VolunteerContext(); Volunteer volunteer = volunteerContext.Volunteers.Single(vol => vol.Id == Id); return(View(volunteer)); }
public ActionResult Edit(Volunteer volunteer) { VolunteerContext volunteerContext = new VolunteerContext(); volunteerContext.Entry(volunteer).State = System.Data.Entity.EntityState.Modified; volunteerContext.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create(Volunteer volunteer) { VolunteerContext volunteerContext = new VolunteerContext(); volunteerContext.Volunteers.Add(volunteer); volunteerContext.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int Id) { VolunteerContext volunteerContext = new VolunteerContext(); Volunteer volunteer = volunteerContext.Volunteers.Single(vol => vol.Id == Id); volunteerContext.Volunteers.Remove(volunteer); volunteerContext.SaveChanges(); return(RedirectToAction("Index")); }
public JwtProvider(RequestDelegate next, VolunteerContext db, UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager) { _next = next; this.db = db; UserManager = userManager; SignInManager = signInManager; //Configure JWT Token settings TokenExpiration = TimeSpan.FromMinutes(10); SigningCredentials = new SigningCredentials(SecurityKey, SecurityAlgorithms.HmacSha256); }
public void Adding_a_project() { using (VolunteerContext context = new VolunteerContext()) { Project project = new Project(); project.Name = "test"; project.Description = " some decription "; project.State = ProjectState.Open; context.Projects.Add(project); context.SaveChanges(); } }
private void InitializeContext() { //This is a 'Global' Arrange. var builder = new DbContextOptionsBuilder <VolunteerContext>() .UseInMemoryDatabase(); var context = new VolunteerContext(builder.Options); var listings = Enumerable.Range(1, 10) .Select(i => new Listing { Id = i, EventName = $"Outreach{i}", ProducerName = "United" }); context.Listings.AddRange(listings); int changed = context.SaveChanges(); Db = context; }
public ListingsController(VolunteerContext context) { this.db = context; }
public UnitOfWork(IDatabaseFactory dbFactory) { this.dbFactory = dbFactory; dataContext = dbFactory.DataContext; }
public UserController(VolunteerContext context) { _context = context; _controller = "Home"; _action = "AllEvents"; }
public DatabaseFactory() { dataContext = new VolunteerContext(); }
public DetailsController(VolunteerContext context) { _context = context; _controller = "User"; _action = "Login"; }
public VolunteerCrudController(VolunteerContext context) { _context = context; }
public CreateController(VolunteerContext context) { _context = context; _controller = "User"; _action = "Login"; }
public MyAccountController(VolunteerContext context) { this.db = context; }