public ActionResult DeleteConfirmed(int id) { EmployeePenaltyType employeePenaltyType = db.EmployeePenaltyTypes.Find(id); db.EmployeePenaltyTypes.Remove(employeePenaltyType); db.SaveChanges(); return(RedirectToAction("PenaltyTypeIndex")); }
public ActionResult Edit([Bind(Include = "Id,PenaltyType,Amount,TimeStamp")] EmployeePenaltyType employeePenaltyType) { if (ModelState.IsValid) { db.Entry(employeePenaltyType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("PenaltyTypeIndex")); } return(View(employeePenaltyType)); }
public ActionResult Create([Bind(Include = "Id,PenaltyType,Amount,TimeStamp")] EmployeePenaltyType employeePenaltyType) { if (ModelState.IsValid) { var datetime = DateTime.Now; employeePenaltyType.TimeStamp = datetime; db.EmployeePenaltyTypes.Add(employeePenaltyType); db.SaveChanges(); return(RedirectToAction("PenaltyTypeIndex")); } return(View(employeePenaltyType)); }
// GET: EmployeePenaltyTypes/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EmployeePenaltyType employeePenaltyType = db.EmployeePenaltyTypes.Find(id); if (employeePenaltyType == null) { return(HttpNotFound()); } return(View(employeePenaltyType)); }
public ActionResult GetPenaltyType() { var list = db.EmployeePenaltyTypes.ToList(); List <EmployeePenaltyType> penalty = new List <EmployeePenaltyType>(); foreach (var item in list) { EmployeePenaltyType p = new EmployeePenaltyType(); p.Id = item.Id; p.PenaltyType = item.PenaltyType; p.Amount = item.Amount; penalty.Add(p); } return(Json(penalty, JsonRequestBehavior.AllowGet)); }