public IEnumerable <Author> Get() { using (var context = new BookStoresContext()){ //Get All Authors // return context.Author.ToList(); // return context.Author.Where(a => a.AuthorId == 1).ToList(); //Add an Author //Author author = new Author(); //author.FirstName = "Abdullah"; //author.LastName = "Qureshi"; //context.Author.Add(author); //context.SaveChanges(); //return context.Author.Where(a => a.FirstName == "Abdullah").ToList(); //Update an Author //Author author = context.Author.Where(a => a.FirstName == "Abdullah").FirstOrDefault(); //author.Phone = "777-777-7777"; //context.SaveChanges(); // return context.Author.Where(a => a.FirstName == "Abdullah").ToList(); //Delete an Author Author author = context.Authors.Where(a => a.FirstName == "Abdullah").FirstOrDefault(); context.Authors.Remove(author); context.SaveChanges(); return(context.Authors.Where(a => a.FirstName == "Abdullah").ToList()); } }
public UsersController(BookStoresContext context, IOptions <JWTSettings> jwtsettings) { _context = context; _jwtsettings = jwtsettings.Value; }
public BasicAuthenticationHandler(IOptionsMonitor <AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, BookStoresContext context) : base(options, logger, encoder, clock) { _context = context; }
public PublishersController(BookStoresContext context) { _context = context; }