Esempio n. 1
0
        public ActionResult Create(Client client)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.Clients.Add(client);
                    db.SaveChanges();
                    return RedirectToAction("Index", "Home");
                }
            }
            catch (Exception)
            {
                ModelState.AddModelError(string.Empty, "Please fill all columns.");
            }

            var faxshows = collector.GetShows(ShowCollector.ShowType.FaxShow, db);
            var emailshows = collector.GetShows(ShowCollector.ShowType.EmailShow, db);
            var printshows = collector.GetShows(ShowCollector.ShowType.PrintShow, db);

            ViewBag.FaxShowId = new SelectList(faxshows, "Value", "Text");
            ViewBag.EmailShowId = new SelectList(emailshows, "Value", "Text");
            ViewBag.PrintShowId = new SelectList(printshows, "Value", "Text");

            return View(client);
        }
Esempio n. 2
0
        public ActionResult Edit(Client client)
        {
            if (ModelState.IsValid)
            {
                db.Entry(client).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index", "Home");
            }

            var faxshows = collector.GetShows(ShowCollector.ShowType.FaxShow, db);
            var emailshows = collector.GetShows(ShowCollector.ShowType.EmailShow, db);
            var printshows = collector.GetShows(ShowCollector.ShowType.PrintShow, db);

            ViewBag.FaxShowId = new SelectList(db.AdareShows, "Value", "Text", client.FaxShowId);
            ViewBag.EmailShowId = new SelectList(db.AdareShows, "Value", "Text", client.EmailShowId);
            ViewBag.PrintShowId = new SelectList(db.AdareShows, "Value", "Text", client.PrintShowId);

            return View(client);
        }