Пример #1
0
        public RedirectToRouteResult Delete(Technology technology, string returnUrl)
        {
            Technology tech = _efDbContext.Technologies.FirstOrDefault(t => t.TechnologyID == technology.TechnologyID);

            if (tech != null)
            {
                _efDbContext.Technologies.Remove(tech);
            }
            _efDbContext.SaveChanges();
            return RedirectToAction("Index", new { returnUrl });
        }
Пример #2
0
        public ActionResult Update(Technology technology, string returnUrl)
        {
            Technology tech = _efDbContext.Technologies.FirstOrDefault(t => t.TechnologyID == technology.TechnologyID);

            if (tech != null)
            {
                tech.TechnologyName = technology.TechnologyName;
                technology.TechnologyType = technology.TechnologyType;
            }
            _efDbContext.SaveChanges();
            return RedirectToAction("Index", new { returnUrl });
        }
Пример #3
0
        public ActionResult Create(Technology technology, string returnUrl)
        {
            Technology tech = new Technology
            {
                TechnologyName = technology.TechnologyName,
                TechnologyType = technology.TechnologyType
            };

            _efDbContext.Technologies.Add(tech);
            _efDbContext.SaveChanges();
            return RedirectToAction("Index", new { returnUrl });
        }