Ejemplo n.º 1
0
        public ActionResult InputTheme(tblTheme model, int?id)
        {
            if (ModelState.IsValid)
            {
                if (id > 0)
                {
                    var cm = db.tblTheme.Where(x => x.ID == id).FirstOrDefault();
                    cm.ID              = Convert.ToInt32(id);
                    cm.Name            = model.Name;
                    db.Entry(cm).State = EntityState.Modified;
                    db.SaveChanges();
                    ModelState.Clear();
                    TempData["msg"] = "Update Succussfully";
                    return(RedirectToAction("ThemeDetails"));
                }
                else
                {
                    model.Name = model.Name;

                    model.Status = true;
                    db.tblTheme.Add(model);
                    db.SaveChanges();
                    ModelState.Clear();
                    TempData["msg"] = " Created Successfully";
                    return(RedirectToAction("ThemeDetails"));
                }
            }
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult InputKPI(int?id, string E)
        {
            if (id > 0 && E == "D")
            {
                tblKPI model = db.tblKPI.Find(id);
                db.Entry(model).State = EntityState.Deleted;
                db.SaveChanges();
                TempData["msg"] = "Deleted Sucessfully!";
                return(RedirectToAction("KPIDetails"));
            }

            else if (id > 0)
            {
                tblTheme model = db.tblTheme.Find(id);
                return(View(model));
            }
            return(View());
        }