public ActionResult DeleteConfirmed(int id) { ThongSo thongso = db.ThongSoes.Find(id); db.ThongSoes.Remove(thongso); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(ThongSo thongso) { if (ModelState.IsValid) { db.Entry(thongso).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(thongso)); }
// // GET: /ThongSo/Edit/5 public ActionResult Edit(int id) { if (Session["isAdmin"] != null && Session["isAdmin"].ToString() == "1") { ThongSo thongso = db.ThongSoes.Find(id); return(View(thongso)); } TempData["myMessage"] = "Bạn cần đăng nhập bằng tài khoản Admin để xe được trang này (^_^)"; return(Redirect("~")); }
public ActionResult Create(ThongSo thongso) { if (ModelState.IsValid) { db.ThongSoes.Add(thongso); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(thongso)); }
public override void DrawSelf(Graphics g) { g.SmoothingMode = SmoothingMode.HighQuality; if (skin) { LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, Color.White, ThongSo.AttributeColor, LinearGradientMode.Vertical); g.FillPath(brush, path); } else { g.FillPath(new SolidBrush(Color.White), path); } Rectangle rect = new Rectangle(this.ClientRectangle.X + 1, this.ClientRectangle.Y + 1, this.ClientRectangle.Width - 2, this.ClientRectangle.Height - 2); Rectangle rect1 = new Rectangle(this.ClientRectangle.X + 6, this.ClientRectangle.Y + 6, this.ClientRectangle.Width - 12, this.ClientRectangle.Height - 12); if (type == AttributeType.Simple) { g.DrawEllipse(ThongSo.JPen, rect); } else if (type == AttributeType.MultiValued) { g.DrawEllipse(ThongSo.JPen, rect); g.DrawEllipse(ThongSo.JPen, rect1); } else if (type == AttributeType.Derived) { g.DrawEllipse(ThongSo.getDashPen(), rect); } else if (type == AttributeType.Key) { g.DrawEllipse(ThongSo.JPen, rect); Font uFont = new Font(ThongSo.JFont.Name, ThongSo.JFont.Size, FontStyle.Underline); g.DrawString(sName, uFont, ThongSo.JBrush, new RectangleF(rect.Location.X + 10, rect.Y, rect.Width - 20, rect.Height), st); if (Entity != null && Entity.type == EntityType.Weak) { SizeF nameSize = g.MeasureString(sName, uFont); Point CenterShape = new Point(rect.Location.X + rect.Width / 2, rect.Y + rect.Height / 2); g.DrawLine(ThongSo.JPen, CenterShape.X - nameSize.Width / 2 + 3, CenterShape.Y + nameSize.Height / 2 + 2, CenterShape.X + nameSize.Width / 2 - 3, CenterShape.Y + nameSize.Height / 2 + 2); } } }
// // GET: /ThongSo/Details/5 public ViewResult Details(int id) { ThongSo thongso = db.ThongSoes.Find(id); return(View(thongso)); }