public ActionResult CreatePractice(vwPractice objprac)
        {
            Practice pra = new Practice();
            pra.PracticeID = objprac.PracticeID;
            pra.PracticeName = objprac.PracticeName;
            pra.NPI = objprac.NPI;
            pra.PhoneNumber = objprac.PhoneNumber;
            pra.State = objprac.State;
            pra.TAXID = objprac.TAXID;
            pra.ZipeCode = objprac.ZipeCode;
            pra.Address1 = objprac.Address1;
            pra.Address2 = objprac.Address2;
            pra.City = objprac.City;
            pra.Description = objprac.Description;
            pra.StatusID = objprac.StatusID;
            pra.Email = objprac.Email;
            pra.StatusID = 1;
            objDbContext.Practices.Add(pra);
            objDbContext.SaveChanges();

            int lastPracticeId = objDbContext.Practices.Max(item => item.PracticeID);

            PracticeUser temp = new PracticeUser();
            //temp = objDbContext.PracticeUsers.Find(objprac.UserID);
            temp.UserName = objprac.UserName;
            temp.Password = objprac.Password;
            temp.PracticeUserType = "Admin";
            temp.Email = objprac.Email;
            temp.PhoneNumber = objprac.PhoneNumber;
            temp.PracticeID = lastPracticeId;
            temp.StatusID = 1;
            objDbContext.PracticeUsers.Add(temp);
            objDbContext.SaveChanges();
            return Json(new { data = "Success" });
        }
 public ActionResult DeleteUser(PracticeUser objEquip)
 {
     var USerlst = (from p in db.PracticeUsers
                              where p.UserID == objEquip.UserID
               select new { p.UserName, p.Password, p.FirstName, p.LastName, p.MiddleName, p.Email, p.PhoneNumber, p.PracticeUserType, p.NPI ,p.StatusID}).ToList()[0];
     //PracticeUser usr = USerlst as PracticeUser;
     PracticeUser usr = db.PracticeUsers.Where(p => p.UserID == objEquip.UserID).First();
     usr.StatusID = 2;
     db.SaveChanges();
     return Json(new { data = "Success" });
 }
        public ActionResult EditUser(PracticeUser objUser)
        {
            PracticeUser objNewUser = (from p in db.PracticeUsers
                                       where p.UserID == objUser.UserID
                                        select p).FirstOrDefault();

            objNewUser.UserName = objUser.UserName;
            objNewUser.Password = objUser.Password;
            objNewUser.FirstName = objUser.FirstName;
            objNewUser.LastName = objUser.LastName;
            objNewUser.MiddleName = objUser.MiddleName;
            objNewUser.Email = objUser.Email;
            objNewUser.PhoneNumber = objUser.PhoneNumber;
            objNewUser.NPI = objUser.NPI;
            objNewUser.PracticeUserType = objUser.PracticeUserType;
            db.SaveChanges();
            return Json(new { data = "Success" });
        }
 public ActionResult CreateUser(PracticeUser objEquip)
 {
     PracticeUser objNewEquip = new PracticeUser();
     objNewEquip.UserName = objEquip.UserName;
     objNewEquip.Password = objEquip.Password;
     objNewEquip.FirstName = objEquip.FirstName;
     objNewEquip.LastName = objEquip.LastName;
     objNewEquip.MiddleName = objEquip.MiddleName;
     objNewEquip.PracticeID = Convert.ToInt32(Session["sespracticeid"]);
     objNewEquip.Email = objEquip.Email;
     objNewEquip.PhoneNumber = objEquip.PhoneNumber;
     objNewEquip.NPI = objEquip.NPI;
     objNewEquip.PracticeUserType = objEquip.PracticeUserType;
     objNewEquip.StatusID = 1;
     db.PracticeUsers.Add(objNewEquip);
     db.SaveChanges();
     return Json(new { data = "Success" });
 }
        public ActionResult GetEquipentData(PracticeUser objEquip)
        {
            var EquipmentsList = (from p in db.PracticeUsers
                                  where p.UserID == objEquip.UserID
                                  select new { p.UserName, p.Password, p.FirstName, p.LastName, p.MiddleName, p.Email, p.PhoneNumber, p.PracticeUserType,p.NPI }).ToList();

            return Json(EquipmentsList);
        }
        public ActionResult EditPractice(vwPractice objprac)
        {
            Practice pra = (from p in objDbContext.Practices
                            where p.PracticeID == objprac.PracticeID
                            select p).FirstOrDefault();
            pra.PracticeID = objprac.PracticeID;
            pra.PracticeName = objprac.PracticeName;
            pra.NPI = objprac.NPI;
            pra.PhoneNumber = objprac.PhoneNumber;
            pra.State = objprac.State;
            pra.TAXID = objprac.TAXID;
            pra.ZipeCode = objprac.ZipeCode;
            pra.Address1 = objprac.Address1;
            pra.Address2 = objprac.Address2;
            pra.City = objprac.City;
            pra.Description = objprac.Description;
            pra.StatusID = 1;
            pra.Email = objprac.Email;
            PracticeUser temp = new PracticeUser();
            temp = objDbContext.PracticeUsers.Find(objprac.UserID);
            temp.UserName = objprac.UserName;
            temp.Password = objprac.Password;
            temp.PracticeUserType = "Admin";

            //if (ModelState.IsValid)
            //{
            //    objDbContext.Entry(pra).State = EntityState.Modified;
            //    objDbContext.Entry(temp).State = EntityState.Modified;
            //    objDbContext.SaveChanges();
            //    return RedirectToAction("Superadminsection");
            //}

            objDbContext.SaveChanges();
            return Json(new { data = "Success" });
        }