public IEnumerable <Product> Get() { Product p = new Product() { Id = 1 }; //{ // description = "First product", // Name = "Name of first", // Price = 99 //}; // c.Add(p); //c.SaveChanges(); List <Product> result = null; result = WebDbContext.Products.ToList(); //= // var p = result.First(); /// c.Remove(p); //c.Update(p); var state = WebDbContext.Entry(p).State; WebDbContext.SaveChanges(); var state2 = WebDbContext.Entry(p).State; return(result); }
public static void DeleteScCompInfoWithoutSelect() { var comp = new ScCompInfo { CompSn = 30 }; using (var db = new WebDbContext()) { //db.ScCompInfoes.Attach(comp); //db.ScCompInfoes.Remove(comp); db.Entry(comp).State = System.Data.Entity.EntityState.Deleted; try { db.SaveChanges(); } catch (System.Data.Entity.Infrastructure.DbUpdateConcurrencyException ex) { ex.Entries.Single().Reload(); } } }
public ActionResult Edit([Bind(Include = "MaMon,TenMon,TichLuy,DiemDat")] MonHoc monHoc) { if (ModelState.IsValid) { db.Entry(monHoc).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(monHoc)); }
public ActionResult Edit([Bind(Include = "DXT_ID,DiemToan,DiemVan,DiemLy,DiemHoa,DiemSinh,DiemDia,DiemGDCD,DiemNN,HinhThucXetTuyen")] DiemXetTuyen diemXetTuyen) { if (ModelState.IsValid) { db.Entry(diemXetTuyen).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(diemXetTuyen)); }
public ActionResult Edit([Bind(Include = "Id,CMND,Khoi,DiemMon1,DiemMon2,DiemMon3")] KhaoSat khaoSat) { if (ModelState.IsValid) { db.Entry(khaoSat).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(khaoSat)); }
public ActionResult Edit([Bind(Include = "id,name")] TYPEROOM tYPEROOM) { if (ModelState.IsValid) { db.Entry(tYPEROOM).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tYPEROOM)); }
public ActionResult Edit([Bind(Include = "BusinessId,BusinessName")] WebBusiness webBusiness) { if (ModelState.IsValid) { db.Entry(webBusiness).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(webBusiness)); }
public ActionResult Edit([Bind(Include = "Id,X,Y,Support,Confidence")] Luat luat) { if (ModelState.IsValid) { db.Entry(luat).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(luat)); }
public ActionResult Edit([Bind(Include = "PositionId,PositionCode,PositionName,AllowanceRate")] Position position) { if (ModelState.IsValid) { db.Entry(position).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(position)); }
public ActionResult Edit([Bind(Include = "id,username,password,role")] MANAGER mANAGER) { if (ModelState.IsValid) { db.Entry(mANAGER).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mANAGER)); }
public ActionResult Edit([Bind(Include = "MaToHop,Mon1,Mon2,Mon3")] ToHopMon toHopMon) { if (ModelState.IsValid) { db.Entry(toHopMon).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(toHopMon)); }
public ActionResult Edit([Bind(Include = "MaKhoaHoc,NamHoc")] KhoaHoc khoaHoc) { if (ModelState.IsValid) { db.Entry(khoaHoc).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(khoaHoc)); }
public ActionResult Edit([Bind(Include = "MaNganh,TeNganh")] NganhTheoBo nganhTheoBo) { if (ModelState.IsValid) { db.Entry(nganhTheoBo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(nganhTheoBo)); }
public ActionResult Edit([Bind(Include = "MaTinh,TenTinh,KhuVuc")] Tinh tinh) { if (ModelState.IsValid) { db.Entry(tinh).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tinh)); }
public ActionResult Edit([Bind(Include = "ID_HocKi,NamHoc,KyHoc")] HocKy hocKy) { if (ModelState.IsValid) { db.Entry(hocKy).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(hocKy)); }
public ActionResult Edit(User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", "people")); } return(View(user)); }
public ActionResult Edit([Bind(Include = "MaHeDaoTao,TenHeDaoTao")] HeDaoTao heDaoTao) { if (ModelState.IsValid) { db.Entry(heDaoTao).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(heDaoTao)); }
public ActionResult Edit([Bind(Include = "id,fullname,address,phoneNumber")] EMPLOYER eMPLOYER) { if (ModelState.IsValid) { db.Entry(eMPLOYER).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(eMPLOYER)); }
public ActionResult Edit([Bind(Include = "MaHuyen,MaTinh,khuvuc,TenHuyen")] Huyen huyen) { if (ModelState.IsValid) { db.Entry(huyen).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaTinh = new SelectList(db.Tinhs, "MaTinh", "TenTinh", huyen.MaTinh); return(View(huyen)); }
public ActionResult Edit([Bind(Include = "MaTruongTHPT,MaHuyen,MaTinh,TenTruong")] TruongTHPT truongTHPT) { if (ModelState.IsValid) { db.Entry(truongTHPT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaHuyen = new SelectList(db.Huyens, "MaHuyen", "khuvuc", truongTHPT.MaHuyen); return(View(truongTHPT)); }
public ActionResult Edit([Bind(Include = "UserId,UserName,Password,FullName,Email,Avatar,IsAdmin,IsActive")] WebAdministrator webAdministrator) { if (ModelState.IsValid) { webAdministrator.Password = Common.EncryptMD5(webAdministrator.UserName + webAdministrator.Password); db.Entry(webAdministrator).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(webAdministrator)); }
public ActionResult Edit([Bind(Include = "CategoryId,CategoryName,OrderNo,Status,UserId")] WebCategory webCategory) { if (ModelState.IsValid) { db.Entry(webCategory).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.Administrators, "UserId", "UserName", webCategory.UserId); return(View(webCategory)); }
public ActionResult Edit([Bind(Include = "PermissionId,PermissionName,Description,BusinessId")] Models.DataModel.WebPermission webPermission) { if (ModelState.IsValid) { db.Entry(webPermission).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BusinessId = new SelectList(db.Businesses, "BusinessId", "BusinessName", webPermission.BusinessId); return(View(webPermission)); }
public ActionResult Edit([Bind(Include = "MaChuyenNganh,TenChuyenNganh,MaKhoa")] ChuyenNganh chuyenNganh) { if (ModelState.IsValid) { db.Entry(chuyenNganh).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MaKhoa = new SelectList(db.Khoas, "MaKhoa", "TenKhoa", chuyenNganh.MaKhoa); return(View(chuyenNganh)); }
public ActionResult Edit([Bind(Include = "PostId,Title,Brief,Content,Picture,CreateDate,Tags,CategoryId,ViewNo,Status,UserId")] WebPost webPost) { if (ModelState.IsValid) { db.Entry(webPost).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.UserId = new SelectList(db.Administrators, "UserId", "UserName", webPost.UserId); ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", webPost.CategoryId); return(View(webPost)); }
public ActionResult Edit([Bind(Include = "MaMon,MSSV,ID_HocKi,DiemTH,DiemQT,DiemThi1,DiemThi2,TiLeDiemTH,TiLeDiemQT,TiLeDiemThi1,TiLeDiemThi2,DiemTKHe10,DiemTKHe4,DiemTKChu")] DiemCTHKy diemCTHKy) { if (ModelState.IsValid) { db.Entry(diemCTHKy).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MSSV = new SelectList(db.DiemHocKys, "MSSV", "MSSV", diemCTHKy.MSSV); ViewBag.MaMon = new SelectList(db.MonHocs, "MaMon", "TenMon", diemCTHKy.MaMon); return(View(diemCTHKy)); }
public ActionResult Edit([Bind(Include = "DepartmentId,DepartmentName,ParentId,LeaderId")] Department department) { if (ModelState.IsValid) { db.Entry(department).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.LeaderId = new SelectList(db.Employees, "EmployeeId", "EmployeeCode", department.LeaderId); ViewBag.ParentId = new SelectList(db.Departments, "DepartmentId", "DepartmentName", department.ParentId); return(View(department)); }
public ActionResult Edit([Bind(Include = "MSSV,ID_HocKi,SoTCDK,SoTCD,SoTCTL,DiemTBTLHe4")] DiemHocKy diemHocKy) { if (ModelState.IsValid) { db.Entry(diemHocKy).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ID_HocKi = new SelectList(db.HocKys, "ID_HocKi", "NamHoc", diemHocKy.ID_HocKi); ViewBag.MSSV = new SelectList(db.SinhViens, "MSSV", "CoVanHocTap", diemHocKy.MSSV); return(View(diemHocKy)); }
public IActionResult EditCategory([FromBody] PageCategory model) { var category = _context.Category.FirstOrDefault(f => f.PageCategoryId == model.PageCategoryId); if (category != null) { _context.Entry(category).CurrentValues.SetValues(model); _context.SaveChanges(); return(Json("ok")); } return(Json(model)); }
public ActionResult Edit([Bind(Include = "id,title,address,image_link,idRoom,price,funcion_1,funcion_2,content,personMax,acreage,allowPet,idEmployer,status,createdate,cratedBy")] ROOM rOOM) { if (ModelState.IsValid) { db.Entry(rOOM).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idEmployer = new SelectList(db.EMPLOYERs, "id", "fullname", rOOM.idEmployer); ViewBag.idRoom = new SelectList(db.TYPEROOMs, "id", "name", rOOM.idRoom); return(View(rOOM)); }