Пример #1
0
 public ActionResult Create(ChartType charttype)
 {
     if (ModelState.IsValid) {
         charttypeRepository.InsertOrUpdate(charttype);
         charttypeRepository.Save();
         return RedirectToAction("Index");
     } else {
         return View();
     }
 }
Пример #2
0
 public void InsertOrUpdate(ChartType charttype)
 {
     if (charttype.Key == default(string)) {
         // New entity
         context.ChartType.Add(charttype);
     } else {
         // Existing entity
         context.ChartType.Attach(charttype);
         context.Entry(charttype).State = EntityState.Modified;
     }
 }