public ActionResult DeleteConfirmed(int id) { ChildDetail childDetail = db.ChildDetails.Find(id); db.ChildDetails.Remove(childDetail); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ChildID,FirstName,LastName,Grade,SchoolID,BusID")] ChildDetail childDetail) { if (ModelState.IsValid) { db.Entry(childDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.BusID = new SelectList(db.Buses, "BusID", "BusNumber", childDetail.BusID); ViewBag.SchoolID = new SelectList(db.Schools, "SchoolID", "SchoolName", childDetail.SchoolID); return(View(childDetail)); }
// GET: ChildDetails/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ChildDetail childDetail = db.ChildDetails.Find(id); if (childDetail == null) { return(HttpNotFound()); } return(View(childDetail)); }
// Element protected override void InternalLayout(Rectangle bounds) { // Read the Min, Max and Natural sizes for the children (for perf reasons) ChildDetail[] childDetails = new ChildDetail[Children.Count]; int naturalWidthSum = 0; int childCount = 0; foreach (IWindowsElement child in Children) { if (child.GetVisible()) { childDetails[childCount] = new ChildDetail(child.MinSize.Width, child.MaxSize.Width, child.NaturalSize.Width); childDetails[childCount].Current = 0; childDetails[childCount].Child = child; naturalWidthSum += childDetails[childCount].Natural; childCount++; } } int deltaWidth = 0; if (naturalWidthSum != 0) { deltaWidth = AllocateProportionally(childDetails, bounds.Width, naturalWidthSum); } // adjust for horizontal alignment if (_horizontalAlignment != HorizontalAlignment.Left) { if (_horizontalAlignment == HorizontalAlignment.Center) { bounds.X += deltaWidth / 2; } else // Right { bounds.X += deltaWidth; } } // Optionally we could force the controls to shrink or grow to take the remaining space (LDeltaWidth) // Now layout the children based on our calculations for (int i = 0; i < childCount; i++) { ChildDetail detail = childDetails[i]; detail.Child.Layout(new Rectangle(bounds.Location, new Size(detail.Current, bounds.Height))); bounds.X += detail.Current; } }
// Element /// <remarks> Arranges the column controls using standard column arrangement. </remarks> protected override void InternalLayout(Rectangle bounds) { // Read the Min, Max and Natural sizes for the children (for perf reasons) ChildDetail[] childDetails = new ChildDetail[Children.Count]; int naturalHeightSum = 0; int childCount = 0; foreach (IWindowsElement child in Children) { if (child.GetVisible()) { childDetails[childCount] = new ChildDetail(child.MinSize.Height, child.MaxSize.Height, child.NaturalSize.Height); childDetails[childCount].Current = 0; childDetails[childCount].Child = child; naturalHeightSum += childDetails[childCount].Natural; childCount++; } } int deltaHeight = 0; if (naturalHeightSum != 0) { deltaHeight = AllocateProportionally(childDetails, bounds.Height, naturalHeightSum); } // adjust for vertical alignment if (_verticalAlignment != VerticalAlignment.Top) { if (_verticalAlignment == VerticalAlignment.Middle) { bounds.Y += deltaHeight / 2; } else // bottom { bounds.Y += deltaHeight; } } // Optionally we could force the controls to shrink or grow to take the remaining space (LDeltaHeight) // Now call SetSize for the children based on our calculations for (int i = 0; i < childCount; i++) { ChildDetail detail = childDetails[i]; detail.Child.Layout(new Rectangle(bounds.Location, new Size(bounds.Width, detail.Current))); bounds.Y += detail.Current; } }
// GET: ChildDetails/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ChildDetail childDetail = db.ChildDetails.Find(id); if (childDetail == null) { return(HttpNotFound()); } ViewBag.BusID = new SelectList(db.Buses, "BusID", "BusNumber", childDetail.BusID); ViewBag.SchoolID = new SelectList(db.Schools, "SchoolID", "SchoolName", childDetail.SchoolID); return(View(childDetail)); }