Example #1
0
        public ActionResult Create(string roleId, string userId)
        {
            var role = db.AspNetRoles.Find(roleId);
            var user = db.AspNetUsers.Find(userId);

            role.AspNetUsers.Add(user);
            db.Entry(role).State = EntityState.Modified;
            db.SaveChanges();

            return(RedirectToAction("Index", "AspNetRoles"));
        }
Example #2
0
 public ActionResult Edit([Bind(Include = "Id,Name")] AspNetRole aspNetRole)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aspNetRole).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aspNetRole));
 }
 public ActionResult Edit([Bind(Include = "MaDH,Email,MaTT,DiaChiNguoiNhan,SDT,TongTien")] DonHang donHang)
 {
     if (ModelState.IsValid)
     {
         db.Entry(donHang).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaTT = new SelectList(db.TrangThaiDonHangs, "MaTT", "TrangThai", donHang.MaTT);
     return(View(donHang));
 }
 public ActionResult Edit(SanPham sanPham)
 {
     ValidateProduct(sanPham);
     if (ModelState.IsValid)
     {
         db.Entry(sanPham).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaLoaiSP = new SelectList(db.LoaiSanPhams, "MaLoaiSP", "TenLoaiSP", sanPham.MaLoaiSP);
     return(View(sanPham));
 }
Example #5
0
 public ActionResult Edit([Bind(Include = "MaCTDH,MaDH,MaSP,SoLuong")] ChiTietDonHang chiTietDonHang)
 {
     ValidateProduct(chiTietDonHang);
     if (ModelState.IsValid)
     {
         db.Entry(chiTietDonHang).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaDH  = new SelectList(db.DonHangs, "MaDH", "Email", chiTietDonHang.MaDH);
     ViewBag.TenSP = new SelectList(db.SanPhams, "MaSP", "TenSP", chiTietDonHang.SanPham.TenSP);
     return(View(chiTietDonHang));
 }
 public ActionResult Profile(KhachHang user)
 {
     db.Entry(user).State = EntityState.Modified;
     db.SaveChanges();
     return(View(user));
 }