public ActionResult DeleteConfirmed(int id)
        {
            PenaltyFee penaltyFee = db.PenaltyFees.Find(id);

            db.PenaltyFees.Remove(penaltyFee);
            db.SaveChanges();
            return(RedirectToAction("PenaltyFeeIndex"));
        }
 public ActionResult Edit([Bind(Include = "Id,Name,Amount")] PenaltyFee penaltyFee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(penaltyFee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("PenaltyFeeIndex"));
     }
     return(View(penaltyFee));
 }
        public ActionResult Create([Bind(Include = "Id,Name,Amount")] PenaltyFee penaltyFee)
        {
            if (ModelState.IsValid)
            {
                db.PenaltyFees.Add(penaltyFee);
                db.SaveChanges();
                return(RedirectToAction("PenaltyFeeIndex"));
            }

            return(View(penaltyFee));
        }
Example #4
0
        // GET: PenaltyFees/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PenaltyFee penaltyFee = db.PenaltyFees.Find(id);

            if (penaltyFee == null)
            {
                return(HttpNotFound());
            }
            return(View(penaltyFee));
        }
        public ActionResult GetPenalty()
        {
            var durationlist = db.PenaltyFees.ToList();
            List <PenaltyFee> duratintype = new List <PenaltyFee>();

            foreach (var item in durationlist)
            {
                PenaltyFee dt = new  PenaltyFee();
                dt.Name   = item.Name;
                dt.Amount = item.Amount;
                duratintype.Add(dt);
            }
            return(Json(duratintype, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            PenaltyFee penaltyFee = db.PenaltyFees.Find(id);

            db.PenaltyFees.Remove(penaltyFee);
            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(View());
            }
            return(RedirectToAction("Index"));
        }
Example #7
0
 public ActionResult Edit([Bind(Include = "PenaltyFeeID,Fee")] PenaltyFee penaltyFee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(penaltyFee).State = EntityState.Modified;
         try
         {
             db.SaveChanges();
         }
         catch (Exception e)
         {
             Console.WriteLine(e);
             return(View());
         }
         return(RedirectToAction("Index", "Home"));
     }
     return(View(penaltyFee));
 }
Example #8
0
        public ActionResult Create([Bind(Include = "PenaltyFeeID,Fee")] PenaltyFee penaltyFee)
        {
            if (ModelState.IsValid)
            {
                db.PenaltyFees.Add(penaltyFee);
                try
                {
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    return(View());
                }
                return(RedirectToAction("Index"));
            }

            return(View(penaltyFee));
        }
Example #9
0
        public async Task <IActionResult> Post([FromBody] PenaltyFee data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            using (DbStudentsContext db = new DbStudentsContext())
            {
                data.State = true;

                var result = await db.AddAsync(data);

                await db.SaveChangesAsync();

                var path = new Uri(HttpContext.Request.Path);
                return(Created(path, data.Id));
            }
        }