Esempio n. 1
0
        public ActionResult RateQuotesListPartialUpdate(APT.BusinessObjects.Models.RateQuote item)
        {
            var model = db.RateQuotes;

            if (ModelState.IsValid)
            {
                try
                {
                    var modelItem = model.FirstOrDefault(it => it.RateQuoteId == item.RateQuoteId);
                    if (modelItem != null)
                    {
                        this.UpdateModel(modelItem);
                        db.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_RateQuotesListPartial", model.ToList()));
        }
Esempio n. 2
0
        public ActionResult RateQuotesListPartialAddNew(APT.BusinessObjects.Models.RateQuote item)
        {
            var model = db.RateQuotes;

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