public ActionResult Update_FS(FormCollection form) { if (!AuthCheck("admin")) { return(RedirectToAction("Index", "QLHome")); } string id = form["idFS_edit"].ToString(); kich_co_do_an fs = db.kich_co_do_an.Where(item => item.id == id).FirstOrDefault(); fs.ten = form["tenFS_edit"].ToString(); db.SaveChanges(); return(Redirect(Url.Action("Index", "QLSetting") + "#FS")); }
private static void InitDataGenerator(string type) { QLBanVePhimEntities db = new QLBanVePhimEntities(); switch (type) { case "GiaVe": if (db.gia_ve.Where(x => x.id == "WEEKDAY").ToList().Count() == 0) { gia_ve gv = new gia_ve(); gv.id = "WEEKDAY"; gv.ten = "Ngay Thuong"; gv.don_gia = 50000; db.gia_ve.Add(gv); } if (db.gia_ve.Where(x => x.id == "WEEKEND").ToList().Count() == 0) { gia_ve gv2 = new gia_ve(); gv2.id = "WEEKEND"; gv2.ten = "Cuoi Tuan"; gv2.don_gia = 70000; db.gia_ve.Add(gv2); } db.SaveChanges(); break; case "LoaiGhe": if (db.loai_ghe.Where(x => x.id == "NORMAL").ToList().Count() == 0) { loai_ghe lg = new loai_ghe(); lg.id = "NORMAL"; lg.ten_ghe = "Normal"; lg.phu_thu = 0; db.loai_ghe.Add(lg); } if (db.loai_ghe.Where(x => x.id == "VIP").ToList().Count() == 0) { loai_ghe lg2 = new loai_ghe(); lg2.id = "VIP"; lg2.ten_ghe = "VIP"; lg2.phu_thu = 0; db.loai_ghe.Add(lg2); } db.SaveChanges(); break; case "FoodSize": if (db.kich_co_do_an.Where(x => x.id == "S").ToList().Count() == 0) { kich_co_do_an fs = new kich_co_do_an { id = "S", ten = "Nhỏ" }; db.kich_co_do_an.Add(fs); } if (db.kich_co_do_an.Where(x => x.id == "M").ToList().Count() == 0) { kich_co_do_an fs2 = new kich_co_do_an { id = "M", ten = "Vừa" }; db.kich_co_do_an.Add(fs2); } if (db.kich_co_do_an.Where(x => x.id == "L").ToList().Count() == 0) { kich_co_do_an fs3 = new kich_co_do_an { id = "L", ten = "Lớn" }; db.kich_co_do_an.Add(fs3); } db.SaveChanges(); break; case "DDP": if (db.dinh_dang_phim.Where(x => x.id == "2d").ToList().Count() == 0) { dinh_dang_phim ddp = new dinh_dang_phim { id = "2d", ten = "2D", phu_thu = 0 }; db.dinh_dang_phim.Add(ddp); } if (db.dinh_dang_phim.Where(x => x.id == "3d").ToList().Count() == 0) { dinh_dang_phim ddp2 = new dinh_dang_phim { id = "3d", ten = "3D", phu_thu = 20000 }; db.dinh_dang_phim.Add(ddp2); } db.SaveChanges(); break; default: break; } }