// All Branches public JsonResult GetAllBranches() { int orgid = OwnerOrgId(); if (orgid == 0) { var totalRecord = branchManager.GetAllBrancheswithOrganizationName().Count(); var branchlist = branchManager.GetAllBrancheswithOrganizationName(); var branches = branchlist.Select(c => new { c.Id, c.Name, c.ShortName, c.Organization, c.OrganizationId, c.LocationName }); return(Json(new { data = branches }, JsonRequestBehavior.AllowGet)); } else { var totalRecord = branchManager.GetAllBrancheswithOrganizationName().Where(c => c.OrganizationId == orgid).Count(); var branchlist = branchManager.GetAllBrancheswithOrganizationName().Where(c => c.OrganizationId == orgid); var branches = branchlist.Select(c => new { c.Id, c.Name, c.ShortName, c.Organization, c.OrganizationId, c.LocationName }); return(Json(new { data = branches }, JsonRequestBehavior.AllowGet)); } }