Example #1
0
 public ActionResult Create(GlossaryMain glossary)
 {
     try
     {
         using (GlossaryDBEntities gEntity = new GlossaryDBEntities())
         {
             gEntity.GlossaryMains.Add(glossary);
             gEntity.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Example #2
0
 public ActionResult Edit(int id, GlossaryMain glossary)
 {
     try
     {
         using (GlossaryDBEntities gEntity = new GlossaryDBEntities())
         {
             gEntity.Entry(glossary).State = EntityState.Modified;
             gEntity.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Example #3
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         using (GlossaryDBEntities gEntity = new GlossaryDBEntities())
         {
             GlossaryMain gMain = gEntity.GlossaryMains.Where(x => x.Id == id).FirstOrDefault();
             gEntity.GlossaryMains.Remove(gMain);
             gEntity.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }