Esempio n. 1
0
        public ActionResult Create(MarketEvent marketevent)
        {
            if (ModelState.IsValid)
            {
                marketevent.RowGuid = Guid.NewGuid();

                db.MarketEvents.Add(marketevent);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CompanyId = new SelectList(db.Companys, "CompanyId", "Name", marketevent.CompanyId);
            return View(marketevent);
        }
Esempio n. 2
0
        public ActionResult Edit(MarketEvent marketevent)
        {
            if (ModelState.IsValid)
            {
                var edititem =
                    db.MarketEvents.Where(a => a.MarketEventId == marketevent.MarketEventId).SingleOrDefault();

                if (edititem != null)
                {
                    TryUpdateModel(edititem, null, null, new[] { "RowGuid" });

                    db.SaveChanges();
                    return RedirectToAction("Index");

                }
            }
            ViewBag.CompanyId = new SelectList(db.Companys, "CompanyId", "Name", marketevent.CompanyId);
            return View(marketevent);
        }