Пример #1
0
 public JsonResult DeleteCategory(int id)
 {
     try
     {
         var item = db.Loais.Find(id);
         if (item == null)
         {
             return(Json(0, JsonRequestBehavior.AllowGet));
         }
         db.Loais.Remove(item);
         db.SaveChanges();
         return(Json(1, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json(0, JsonRequestBehavior.AllowGet));
     }
 }
Пример #2
0
        public JsonResult DangKy(KhachHang model)
        {
            if (ModelState.IsValid)
            {
                model.UserPassword = MD5Hash(model.UserPassword);
                model.NgayDangKy   = DateTime.Now;

                var db = new WebDungCuHocTapDbContext();
                db.KhachHangs.Add(model);
                db.SaveChanges();

                return(Json(new { Success = 1 }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { Success = 0 }, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public JsonResult CheckOut(DatHang model)
        {
            if (ModelState.IsValid)
            {
                model.NgayDatHang = DateTime.Now;
                //model.TongTien =
                model.MaTT = 1;

                var db = new WebDungCuHocTapDbContext();
                db.DatHangs.Add(model);
                db.SaveChanges();

                return(Json(new { Success = 1 }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { Success = 0 }, JsonRequestBehavior.AllowGet));
        }