private BaseResponse deleteApplicationUser(string userId) { BaseResponse baseResponse = new BaseResponse(); using (dbLawCMSEntities db = new dbLawCMSEntities()) { var data = db.AspNetUsers.Where(x => x.Id == userId).FirstOrDefault(); if (data != null) { data.Active = false; db.Entry(data).State = EntityState.Modified; int Result = db.SaveChanges(); if (Result > 0) { baseResponse.Success = true; } else { baseResponse.Success = false; baseResponse.Message = "User not deleted"; } } else { baseResponse.Success = false; baseResponse.Message = "User not found"; } } return(baseResponse); }
public ActionResult GetAllCases() { BaseResponse baseResponse = new BaseResponse(); using (dbLawCMSEntities db = new dbLawCMSEntities()) { baseResponse.Result = ( from a in db.tbl_Case //join b in db.tbl_Client on a.Client_ID equals b.Client_ID //where a.Email != "*****@*****.**" && a.Active select new CaseViewModel() { Case_Title = a.Case_Title, Case_Description = a.Case_Description, Status = a.Status, } ).ToList(); } baseResponse.Success = true; return(new JsonResult { Data = baseResponse, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
//[ValidateAntiForgeryToken] public ActionResult GetUserTypes() { //ViewBag.BranchList = _branchService.GetBranchList(); BaseResponse baseResponse = new BaseResponse(); using (dbLawCMSEntities db = new dbLawCMSEntities()) { baseResponse.Result = ( from a in db.AspNetRoles //join b in db.BrandBranches on a.BranchId equals b.BranchId //where a.Email != "*****@*****.**" && a.Active select new UserRoleViewModel() { Id = a.Id, Name = a.Name //Branch = b.BranchName, //Active = a.Active == true ? "Yes" : "No" } ).ToList(); } baseResponse.Success = true; return(new JsonResult { Data = baseResponse, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult Index() { tbl_Case tbl_Case = new tbl_Case(); using (dbLawCMSEntities db = new dbLawCMSEntities()) { } return(View()); }
public ActionResult GetDashboardData() { BaseResponse baseResponse = new BaseResponse(); try { DashboardViewModel response = new DashboardViewModel(); using (dbLawCMSEntities db = new dbLawCMSEntities()) { response.totalClients = db.tbl_Client.Count(); response.totalCases = db.tbl_Case.Count(); response.completedCases = db.tbl_Case.Where(x => x.Status == "Completed").Count(); response.inCompleteCases = db.tbl_Case.Where(x => x.Status == "InCompleted").Count(); //response.cases = db.tbl_Case.OrderByDescending(x => x.Case_Date).Take(5).ToList(); response.cases = ( from a in db.tbl_Case join b in db.tbl_Client on a.Client_ID equals b.Client_ID join c in db.tbl_Type_Of_Matter on a.Type_Of_Matter_ID equals c.Type_Of_Matter_ID select new CaseViewModel() { CaseId = a.Case_ID, Title = a.Case_Title, ClientName = b.First_Name + " " + b.Last_Name, Matter = c.Type_Of_Matter, Date = a.Case_Date } ).Take(10).OrderByDescending(x => x.Date).ToList(); } baseResponse.Success = true; baseResponse.Result = response; return(new JsonResult { Data = baseResponse, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } catch (Exception) { baseResponse.Success = false; return(new JsonResult { Data = baseResponse, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }
public ActionResult CreateCase(AddCaseViewModel addCaseViewModel) { BaseResponse baseResponse = new BaseResponse(); using (dbLawCMSEntities db = new dbLawCMSEntities()) { db.tbl_Case.Add(addCaseViewModel.Case); db.tbl_Client.Add(addCaseViewModel.Client); db.tbl_Case_Attachments.Add(addCaseViewModel.Attachments); db.tbl_Case_Notes.Add(addCaseViewModel.Notes); db.SaveChanges(); } return(new JsonResult { Data = baseResponse, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
//[ValidateAntiForgeryToken] public ActionResult GetUser(string UserId) { using (dbLawCMSEntities db = new dbLawCMSEntities()) { //List<AspNetUser> v = db.AspNetUsers.ToList(); var users = ( from a in db.AspNetUsers //join b in db.AspNetRoles on a.Id equals b.Id where a.Id == UserId select new ApplicationUserViewModel() { Id = a.Id, Email = a.Email, Password = a.Password, Active = a.Active, FirstName = a.FirstName, LastName = a.LastName, PhoneNo = a.PhoneNo, //Branch = b.BranchName, //Active = a.Active == true ? "Yes" : "No" } ).ToList(); foreach (var item in users) { if (item.Password != null) { item.Password = DataProtectionLib.Decrypt(item.Password); item.ConfirmPassword = item.Password; } } return(new JsonResult { Data = users, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } }