Пример #1
0
 public ActionResult SignUp(User u)
 {
     if (ModelState.IsValid)
     {
         db.Users.Add(u);
         db.SaveChanges();
         return(RedirectToAction("Login"));
     }
     return(View(u));
 }
        public void SetUp()
        {
            _builder = new DbContextOptionsBuilder <ECommerceDBContext>().EnableSensitiveDataLogging().UseInMemoryDatabase(Guid.NewGuid().ToString());
            ECommerceDBContext eCommerceDBContext = new ECommerceDBContext(_builder.Options);

            sellerRepository = new SellerRepository(eCommerceDBContext);
            eCommerceDBContext.Seller.Add(new Seller {
                Sellerid = 800, Username = "******", Password = "******", Companyname = "infosys", Gst = 47, Aboutcmpy = "gud", Address = "bangalore", Website = "www.infy.com", Email = "*****@*****.**", Mobileno = "9535678900"
            });
            eCommerceDBContext.SaveChanges();
        }
Пример #3
0
        public void SetUp()
        {
            _builder = new DbContextOptionsBuilder <ECommerceDBContext>().EnableSensitiveDataLogging().UseInMemoryDatabase(Guid.NewGuid().ToString());
            ECommerceDBContext sellerContext = new ECommerceDBContext(_builder.Options);

            itemRepository = new ItemRepository(sellerContext);
            sellerContext.Items.Add(new Items {
                Itemid = 1, Itemname = "lg", Price = "10000", Description = "tv", Stockno = 123, Remarks = "good", Sellerid = 1
            });
            sellerContext.SaveChanges();
        }
Пример #4
0
        public void DeleteItems(int id)
        {
            Items items  = _context.Items.Find(id);
            Items items1 = new Items();

            if (items != null)
            {
                items1.Id          = items.Id;
                items1.Sid         = items.Sid;
                items1.Itemname    = items.Itemname;
                items1.Price       = items.Price;
                items1.Remarks     = items.Remarks;
                items1.Stockno     = items.Stockno;
                items1.Description = items.Description;
            }
            _context.Remove(items1);
            _context.SaveChanges();
        }