public ActionResult DeleteConfirmed(double id) { Punish punish = db.Punishes.Find(id); db.Punishes.Remove(punish); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Money,pushUp,Date,StudentRollNumber")] Punish punish) { if (ModelState.IsValid) { db.Entry(punish).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StudentRollNumber = new SelectList(db.Students, "RollNumber", "Name", punish.StudentRollNumber); return(View(punish)); }
// GET: Punishes/Details/5 public ActionResult Details(double?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Punish punish = db.Punishes.Find(id); if (punish == null) { return(HttpNotFound()); } return(View(punish)); }
// GET: Punishes/Edit/5 public ActionResult Edit(double?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Punish punish = db.Punishes.Find(id); if (punish == null) { return(HttpNotFound()); } ViewBag.StudentRollNumber = new SelectList(db.Students, "RollNumber", "Name", punish.StudentRollNumber); return(View(punish)); }
/// <summary> /// Applies the setting. /// </summary> /// <param name="setting">The setting.</param> public void ApplySetting(ControlSettings setting) { if (!string.IsNullOrEmpty(setting.HelpMessage)) { this.HelpMessage = setting.HelpMessage; } Help.ApplySetting(setting.Help); Seen.ApplySetting(setting.Seen); Files.ApplySetting(setting.Files); Stick.ApplySetting(setting.Stick); SeenGroup.ApplySetting(setting.SeenGroup); SeenModerator.ApplySetting(setting.SeenModerator); Moderator.ApplySetting(setting.Moderator); Hours.ApplySetting(setting.Hours); Punish.ApplySetting(setting.Punish); SelfGroup.ApplySetting(setting.SelfGroup); }
public ActionResult Create([Bind(Include = "Id,Money,pushUp,Date,StudentRollNumber")] Punish punish) { if (ModelState.IsValid) { var res = db.Punishes.Where(p => p.StudentRollNumber == punish.StudentRollNumber && p.Date == punish.Date); if (res.Any()) { var currentPunish = res.First(); currentPunish.pushUp += punish.pushUp; currentPunish.Money += punish.Money; } else { db.Punishes.Add(punish); } db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.StudentRollNumber = new SelectList(db.Students, "RollNumber", "Name", punish.StudentRollNumber); return(View(punish)); }