Beispiel #1
0
        public ActionResult DeleteConfirmed(long id)
        {
            PayRollMaster payRollMaster = db.PayRollMasters.Find(id);

            db.PayRollMasters.Remove(payRollMaster);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        // GET: PayRollMaster/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PayRollMaster payRollMaster = db.PayRollMasters.Find(id);

            if (payRollMaster == null)
            {
                return(HttpNotFound());
            }
            return(View(payRollMaster));
        }
        public bool delete(long id)
        {
            PayRollMaster payRollMaster = db.PayRollMaster.Find(id);

            if (payRollMaster != null)
            {
                db.PayRollMaster.Remove(payRollMaster);
                db.SaveChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
 public ActionResult Edit([Bind(Include = "PayRollCode,PayRollName")] PayRollMaster payRollMaster)
 {
     if (ModelState.IsValid)
     {
         bool isValid = db.PayRollMasters.Any(x => (x.PayRollCode != payRollMaster.PayRollCode) && (x.PayRollName == payRollMaster.PayRollName));
         if (!isValid)
         {
             db.Entry(payRollMaster).State = EntityState.Modified;
             db.SaveChanges();
             ViewBag.success = "Your Record Successfully Updated!";
             return(View());
         }
         else
         {
             ViewBag.error = "PayRoll is Already exist!";
             return(View());
         }
     }
     return(View(payRollMaster));
 }
Beispiel #5
0
        public ActionResult Create([Bind(Include = "PayRollCode,PayRollName")] PayRollMaster payRollMaster)
        {
            if (ModelState.IsValid)
            {
                bool isValid = db.PayRollMasters.Any(x => x.PayRollName == payRollMaster.PayRollName);
                if (!isValid)
                {
                    db.PayRollMasters.Add(payRollMaster);
                    db.SaveChanges();
                    ViewBag.success = "PayRoll is Successfully created!";
                    ModelState.Clear();
                    return(View());
                }
                else
                {
                    ViewBag.error = "Sorry! PayRoll is already exist!";
                    return(View(payRollMaster));
                }
            }

            return(View(payRollMaster));
        }