public ActionResult AddOrEdit(Ticket emp)
 {
     using (BugDBEntities db = new BugDBEntities())
     {
         if (emp.TicketID == 0)
         {
             db.Tickets.Add(emp);
             db.SaveChanges();
             return(Json(new { success = true, message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             db.Entry(emp).State = EntityState.Modified;
             db.SaveChanges();
             return(Json(new { success = true, message = "Updated Successfully" }, JsonRequestBehavior.AllowGet));
         }
     }
 }
 public ActionResult Delete(int id)
 {
     using (BugDBEntities db = new BugDBEntities())
     {
         Ticket emp = db.Tickets.Where(x => x.TicketID == id).FirstOrDefault <Ticket>();
         db.Tickets.Remove(emp);
         db.SaveChanges();
         return(Json(new { success = true, message = "Deleted Successfully" }, JsonRequestBehavior.AllowGet));
     }
 }
 public ActionResult AddorEdit(SelectedCategory emp)
 {
     //multi select dropdown
     emp.SelectedCategoryIDs = string.Join(",", emp.SelectedIDArray);
     using (BugDBEntities db = new BugDBEntities())
     {
         if (emp.ID == 0)
         {
             db.SelectedCategories.Add(emp);
         }
         else
         {
             db.Entry(emp).State = EntityState.Modified;
         }
         db.SaveChanges();
     }
     return(RedirectToAction("AddOrEdit", new { id = 0 }));
 }