Example #1
0
        public ActionResult RQLegsUpdate(APT.BusinessObjects.Models.RQLeg item)
        {
            var model = db.RQLegs;

            if (ModelState.IsValid)
            {
                try
                {
                    var modelItem = model.FirstOrDefault(it => it.RQLegId == item.RQLegId);
                    if (modelItem != null)
                    {
                        this.UpdateModel(modelItem);
                        db.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_RQLegs", model.ToList()));
        }
Example #2
0
        public ActionResult RQLegsAddNew(APT.BusinessObjects.Models.RQLeg item)
        {
            var model = db.RQLegs;

            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("_RQLegs", model.ToList()));
        }