Ejemplo n.º 1
0
        public ActionResult AddInstrument(Instrument instrument)
        {
            if (_dashboardSP.CheckDuplicate <Instrument>(instrument.InstrumentName, instrument.Website))
            {
                TempData["CustomError"] = "Instrument ( " + instrument.InstrumentName + " ) already exists!";
                ModelState.AddModelError("CustomError", "Instrument ( " + instrument.InstrumentName + " ) already exists!");
            }

            if (ModelState.IsValid)
            {
                _dashboardSP.Add(instrument);

                return(RedirectToAction("Index"));
            }

            return(RedirectToAction("AddInstrument"));
        }