Exemplo n.º 1
0
        public ActionResult ReportSettingPartialUpdate(Database.ReportSetting item)
        {
            var model = db.ReportSettings;

            if (ModelState.IsValid)
            {
                try
                {
                    var modelItem = model.FirstOrDefault(it => it.id == item.id);
                    if (modelItem != null)
                    {
                        this.UpdateModel(modelItem);
                        db.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_ReportSettingPartial", model.ToList()));
        }
Exemplo n.º 2
0
        public ActionResult ReportSettingPartialAddNew(Database.ReportSetting item)
        {
            var model = db.ReportSettings;

            if (ModelState.IsValid)
            {
                try
                {
                    model.Add(item);
                    db.SaveChanges();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_ReportSettingPartial", model.ToList()));
        }