コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            EmployeePenaltyType employeePenaltyType = db.EmployeePenaltyTypes.Find(id);

            db.EmployeePenaltyTypes.Remove(employeePenaltyType);
            db.SaveChanges();
            return(RedirectToAction("PenaltyTypeIndex"));
        }
コード例 #2
0
 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));
 }
コード例 #3
0
        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));
        }
コード例 #4
0
        // 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));
        }
コード例 #5
0
        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));
        }