public void Registration(User user)
        {
            IdentityResult iuser = u.Create(user, user.PasswordHash);

            db.Users.Add(user);
            db.SaveChanges();
        }
        public ActionResult Create([Bind(Include = "id,title,SBIN,NumberOfCopied,describtion")] Book book)
        {
            if (ModelState.IsValid)
            {
                db.Books.Add(book);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(book));
        }
        public ActionResult Registeration(User user)
        {
            if (!ModelState.IsValid)
            {
                return(View(user));
            }

            user.PasswordHash = CustomEncrypt.Encrypt(user.PasswordHash);
            _context.Users.Add(user);
            _context.SaveChanges();

            var identity = new ClaimsIdentity(new[] {
                new Claim(ClaimTypes.Name, user.UserName)
            }, "ApplicationCookie");

            var ctx         = Request.GetOwinContext();
            var authManager = ctx.Authentication;

            authManager.SignIn(identity);

            return(RedirectToAction("Index", "Book"));
        }
 public void CreateBook(Book book)
 {
     db.Books.Add(book);
     db.SaveChanges();
 }