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());
            }
        }
예제 #2
0
 public UsersController(BookStoresContext context, IOptions <JWTSettings> jwtsettings)
 {
     _context     = context;
     _jwtsettings = jwtsettings.Value;
 }
예제 #3
0
 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;
 }