예제 #1
0
        public ActionResult NcrGridViewUpdate(HseqCentralApp.Models.Ncr item)
        {
            var model = db3.NcrRecords;

            if (ModelState.IsValid)
            {
                try
                {
                    var modelItem = model.FirstOrDefault(it => it.HseqRecordID == item.HseqRecordID);
                    if (modelItem != null)
                    {
                        this.UpdateModel(modelItem);
                        db3.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_NcrGridView", model.ToList()));
        }
예제 #2
0
        public ActionResult NcrGridViewAddNew(HseqCentralApp.Models.Ncr item)
        {
            var model = db3.NcrRecords;

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