public ActionResult EditType(int id)
        {
            ViewBag.CatList = oDBContext.CCCALLCATAGORies.Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });

            oCCCALLTYPE = oDBContext.CCCALLTYPEs.FirstOrDefault(t => t.ID == id);

            return(PartialView("_EditTypePartial", oCCCALLTYPE));
        }
        public ActionResult CreateType()
        {
            oCCCALLTYPE          = new CCCALLTYPE();
            oCCCALLTYPE.ISACTIVE = true;

            ViewBag.CatList = oDBContext.CCCALLCATAGORies.Select(x => x).ToList().Select(x => new SelectListItem
            {
                Value = x.ID.ToString(),
                Text  = x.NAME.ToString()
            });


            return(PartialView("_EditTypePartial", oCCCALLTYPE));
        }
        public ActionResult InsertEditType(CCCALLTYPE oCCCALLTYPE, string btnName)
        {
            var errors = ModelState.Values.SelectMany(v => v.Errors);

            try
            {
                if (ModelState.IsValid)
                {
                    oCurrentUser = (CCUSER)Session["User"];
                    switch (btnName)
                    {
                    case "create":
                        oCCCALLTYPE.ISACTIVE  = true;
                        oCCCALLTYPE.CREATEDBY = oCurrentUser.ID;
                        oCCCALLTYPE.CREATEDON = DateTime.Now;

                        oDBContext.CCCALLTYPEs.Add(oCCCALLTYPE);
                        oDBContext.SaveChanges();
                        TempData["SuccessMsg"] = "Data Saved Successfully.";
                        break;

                    case "update":
                        oCCCALLTYPE.MODIFIEDBY = oCurrentUser.ID;
                        oCCCALLTYPE.MODIFIEDON = DateTime.Now;
                        oDBContext.Entry(oCCCALLTYPE).State = EntityState.Modified;
                        oDBContext.SaveChanges();
                        TempData["SuccessMsg"] = "Data Updated Successfully.";
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                TempData["ErrorMsg"] = "Data is not saved due to " + ExceptionMsg(ex);
            }
            return(RedirectToAction("Index"));
        }