public string SaveQuestions(QuestionsEntity questions) { UserSessionInfo objinfo = new UserSessionInfo(); string strResponse = string.Empty; UserSessionInfo sessionInfo = new UserSessionInfo(); // int uid = sessionInfo.userid; using (EvolutyzCornerDataEntities db = new EvolutyzCornerDataEntities()) { try { db.Set <QuestionBank>().Add(new QuestionBank { TechnologyStackId = questions.TechnologyStackId, Question = questions.Question1, Option1 = questions.Option1, Option2 = questions.Option2, Option3 = questions.Option3, Option4 = questions.Option4, Answer = questions.Answer, CreatedDate = DateTime.Now, CreatedBy = objinfo.UserId }); db.SaveChanges(); strResponse = "Record Sucessfully Created "; } catch (Exception ex) { throw ex; } } return(strResponse); }
public AccountSpecifictasks GetTaskDetailByID(string id) { int pro_spe_id = Convert.ToInt32(id); try { using (var db = new EvolutyzCornerDataEntities()) { var query = (from pt in db.AccountSpecificTasks join gt in db.GenericTasks on pt.tsk_TaskID equals gt.tsk_TaskID join p in db.Accounts on pt.AccountID equals p.Acc_AccountID where pt.Acc_SpecificTaskId == pro_spe_id select new AccountSpecifictasks { Acc_SpecificTaskId = pt.Acc_SpecificTaskId, AccountID = pt.AccountID, Acc_AccountName = p.Acc_AccountName, Acc_SpecificTaskName = pt.Acc_SpecificTaskName, tsk_TaskID = pt.tsk_TaskID, tsk_TaskName = gt.tsk_TaskName, //StatusId = pt.StatusId, isDeleted = pt.isDeleted, }).FirstOrDefault(); return(query); } } catch (Exception) { return(null); } }
public ActionResult updateSkills(int userID, string SkillsTitle, string yearExp, string monthExp) { try { UserProjectdetailsEntity sessId = new UserProjectdetailsEntity(); // int userID = sessId.User_ID; string yearMonth = yearExp + "." + monthExp; EvolutyzCornerDataEntities evolutyzData = new EvolutyzCornerDataEntities(); UserSkill skills = evolutyzData.UserSkills.SingleOrDefault(u => u.Usr_UserId == userID); skills.SkillId = Convert.ToInt32(SkillsTitle); skills.Experience = yearMonth; int response = evolutyzData.SaveChanges(); if (response > 0) { return(Json("Data Updated Successfully", JsonRequestBehavior.AllowGet)); } else { return(Json("Updation Failed and Please Try Again!!", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { throw ex; } }
public List <TaskEntity> SelectTask() { using (var db = new EvolutyzCornerDataEntities()) { try { var query = (from q in db.GenericTasks where q.tsk_isDeleted == false && q.tsk_ActiveStatus == true select new TaskEntity { tsk_TaskID = q.tsk_TaskID, tsk_TaskName = q.tsk_TaskName, tsk_TaskDescription = q.tsk_TaskDescription, tsk_ActiveStatus = q.tsk_ActiveStatus, tsk_Version = q.tsk_Version, tsk_CreatedBy = q.tsk_CreatedBy, tsk_CreatedDate = q.tsk_CreatedDate, tsk_ModifiedBy = q.tsk_ModifiedBy, tsk_ModifiedDate = q.tsk_ModifiedDate, tsk_isDeleted = q.tsk_isDeleted, }).OrderBy(x => x.tsk_TaskName).ToList(); return(query); } catch (Exception ex) { return(null); } } }
public List <ProjectAllocationEntity> GetUserNames() { List <ProjectAllocationEntity> lstUsers = new List <ProjectAllocationEntity>(); using (var db = new EvolutyzCornerDataEntities()) { try { lstUsers = (from u in db.Users select new ProjectAllocationEntity { UProj_UserID = u.Usr_UserID, Username = u.Usr_Username }).ToList(); lstUsers.Add(new ProjectAllocationEntity { UProj_UserID = 0, Username = "******" }); lstUsers = lstUsers.OrderBy(p => p.UProj_UserID).ToList(); return(lstUsers); } catch (Exception ex) { return(null); } } }
public List <UserProfileEntity> GetAllSocialMediaIcons(int accountid) { List <UserProfileEntity> response = new List <UserProfileEntity>(); using (var db = new EvolutyzCornerDataEntities()) { try { response = (from h in db.SocialMedias //where h.Sm_AccountID == accountid select new UserProfileEntity { SocialMediaId = h.SocialMediaId, Icon = h.Icon, Title = h.Title, Url = h.Url }).ToList(); return(response); } catch (Exception ex) { return(null); } } }
public List <LeaveSchemeEntity> GetLeaveTypes(string ID, int yearid) { using (var db = new EvolutyzCornerDataEntities()) { var id = Convert.ToInt32(ID); var yid = Convert.ToInt32(yearid); try { var response = (from ls in db.LeaveSchemes join l in db.LeaveTypes on ls.LSchm_LeaveTypeID equals l.LTyp_LeaveTypeID where ls.LSchm_UserTypeID == id && ls.FinancialYearId == yid select new LeaveSchemeEntity { LSchm_LeaveTypeID = ls.LSchm_LeaveTypeID, LSchm_LeaveCount = ls.LSchm_LeaveCount, LeaveType = l.LTyp_LeaveType }).ToList(); return(response); } catch (Exception ex) { return(null); } } }
public List <OrganizationAccountEntity> SelectAccount() { using (var db = new EvolutyzCornerDataEntities()) { try { var query = (from c in db.Accounts where c.Acc_isDeleted == false && c.Acc_ActiveStatus == true select new OrganizationAccountEntity { Acc_AccountID = c.Acc_AccountID, Acc_AccountCode = c.Acc_AccountCode, Acc_AccountName = c.Acc_AccountName, Acc_AccountDescription = c.Acc_AccountDescription, Acc_EmailID = c.Acc_EmailID, Acc_MobileNumber = c.Acc_MobileNumber, Acc_PhoneNumber = c.Acc_PhoneNumber, Acc_CompanyLogo = c.Acc_CompanyLogo.Replace(" ", "%20"), Acc_ActiveStatus = c.Acc_ActiveStatus, Acc_Version = c.Acc_Version, Acc_CreatedBy = c.Acc_CreatedBy, Acc_CreatedDate = System.DateTime.Now, is_UsAccount = c.is_UsAccount }).OrderBy(x => x.Acc_AccountName).ToList(); return(query); } catch (Exception ex) { return(null); } } }
public List <HistoryOrganizationAccountEntity> GetHistoryAccountDetailsByID(int accID) { using (var db = new EvolutyzCornerDataEntities()) { try { var query = (from q in db.History_Account where q.History_Acc_AccountID == accID select new HistoryOrganizationAccountEntity { History_Account_AccountID = q.History_Account_AccountID, History_Acc_AccountCode = q.History_Acc_AccountCode, History_Acc_AccountName = q.History_Acc_AccountName, History_Acc_AccountDescription = q.History_Acc_AccountDescription, History_Acc_EmailID = q.History_Acc_EmailID, History_Acc_MobileNumber = q.History_Acc_MobileNumber, History_Acc_PhoneNumber = q.History_Acc_PhoneNumber, History_Acc_CompanyLogo = q.History_Acc_CompanyLogo.Replace(" ", "%20"), History_Acc_ActiveStatus = q.History_Acc_ActiveStatus, History_Acc_Version = q.History_Acc_Version, History_Acc_CreatedBy = q.History_Acc_CreatedBy, History_Acc_CreatedDate = q.History_Acc_CreatedDate, History_Acc_ModifiedBy = q.History_Acc_ModifiedBy, History_Acc_ModifiedDate = q.History_Acc_ModifiedDate, History_Acc_isDeleted = q.History_Acc_isDeleted, }).OrderBy(x => x.History_Acc_AccountName).ToList(); return(query); } catch (Exception ex) { return(null); } } }
public List <UserTypeEntity> SelectUserType() { using (var db = new EvolutyzCornerDataEntities()) { try { var query = (from q in db.UserTypes join a in db.Accounts on q.UsT_AccountID equals a.Acc_AccountID where q.UsT_isDeleted == false && q.UsT_ActiveStatus == true select new UserTypeEntity { UsT_UserTypeID = q.UsT_UserTypeID, UsT_AccountID = q.UsT_AccountID, AccountName = a.Acc_AccountName, UsT_UserTypeCode = q.UsT_UserTypeCode, UsT_UserType = q.UsT_UserType, UsT_UserTypeDescription = q.UsT_UserTypeDescription, UsT_ActiveStatus = q.UsT_ActiveStatus, UsT_Version = q.UsT_Version, UsT_CreatedBy = q.UsT_CreatedBy, UsT_CreatedDate = q.UsT_CreatedDate, UsT_ModifiedBy = q.UsT_ModifiedBy, UsT_ModifiedDate = q.UsT_ModifiedDate, UsT_isDeleted = q.UsT_isDeleted, }).OrderBy(x => x.UsT_UserType).ToList(); return(query); } catch (Exception ex) { return(null); } } }
//History #region To get particular UserType Account details from Database public List <History_UserTypeEntity> GetHistoryUserTypeDetailsByID(int ID) { using (var db = new EvolutyzCornerDataEntities()) { try { var query = (from q in db.History_UserType join a in db.Accounts on q.History_AccountID equals a.Acc_AccountID where q.History_UsT_UserTypeID == ID select new History_UserTypeEntity { History_UserType_ID = q.History_UserType_ID, History_UsT_UserTypeID = q.History_UsT_UserTypeID, History_UsT_AccountID = q.History_AccountID, AccountName = a.Acc_AccountName, History_UsT_UserTypeCode = q.History_UsT_UserTypeCode, History_UsT_UserType = q.History_UsT_UserType, History_UsT_UserTypeDescription = q.History_UsT_UserTypeDescription, History_UsT_ActiveStatus = q.History_UsT_ActiveStatus, History_UsT_Version = q.History_UsT_Version, History_UsT_CreatedBy = q.History_UsT_CreatedBy, History_UsT_CreatedDate = q.History_UsT_CreatedDate, History_UsT_ModifiedBy = q.History_UsT_ModifiedBy, History_UsT_ModifiedDate = q.History_UsT_ModifiedDate, History_UsT_isDeleted = q.History_UsT_isDeleted, }).OrderBy(x => x.History_UsT_UserType).ToList(); return(query); } catch (Exception ex) { return(null); } } }
public string updateSkills(string SkillsTitle, string yearExp, string monthExp, int userskillid) { try { UserProjectdetailsEntity sessId = new UserProjectdetailsEntity(); int userID = sessId.User_ID; int skillid = Convert.ToInt32(SkillsTitle); string yearMonth = yearExp + "." + monthExp; EvolutyzCornerDataEntities evolutyzData = new EvolutyzCornerDataEntities(); UserSkill skillcheck = evolutyzData.Set <UserSkill>().Where(s => (s.SkillId == skillid && s.Usr_UserId == userID && s.Is_Deleted == false && s.Usr_SkillId != userskillid)).FirstOrDefault <UserSkill>(); if (skillcheck != null) { return("Skill Already Exist"); } UserSkill skills = evolutyzData.UserSkills.SingleOrDefault(u => u.Usr_SkillId == userskillid); skills.SkillId = Convert.ToInt32(SkillsTitle); skills.Experience = yearMonth; int response = evolutyzData.SaveChanges(); if (response > 0) { return("Data Updated Successfully"); } else { return("Try Again!!"); } } catch (Exception) { throw; } }
public List <RoleEntity> SelectRole() { using (var db = new EvolutyzCornerDataEntities()) { try { var query = (from q in db.Roles join a in db.Accounts on q.Rol_AccountID equals a.Acc_AccountID join gr in db.GenericRoles on q.Rol_RoleName equals gr.GenericRoleID where q.Rol_isDeleted == false select new RoleEntity { Rol_RoleID = q.Rol_RoleID, Rol_AccountID = q.Rol_AccountID, AccountName = a.Acc_AccountName, Rol_RoleCode = q.Rol_RoleCode, Rol_RoleName = gr.Title, Rol_RoleDescription = q.Rol_RoleDescription, Rol_ActiveStatus = q.Rol_ActiveStatus, Rol_Version = q.Rol_Version, Rol_createdBy = q.Rol_createdBy, Rol_CreatedDate = q.Rol_CreatedDate, Rol_ModifiedBy = q.Rol_ModifiedBy, Rol_ModifiedDate = q.Rol_ModifiedDate, Rol_isDeleted = q.Rol_isDeleted, }).OrderBy(x => x.Rol_RoleName).ToList(); return(query); } catch (Exception ex) { return(null); } } }
public List <RoleEntity> Getmodulesselected(int ID) { //RoleEntity response = new RoleEntity(); using (var db = new EvolutyzCornerDataEntities()) { try { var response = (from q in db.RoleModules join sm in db.Master_Sub_Module on q.Sub_ModuleID equals sm.Sub_ModuleID join mm in db.Master_Module on sm.Mod_ModuleID equals mm.Mod_ModuleID // join a in db.Roles on q.RMod_RoleID equals a.Rol_RoleID where q.RMod_RoleID == ID && q.RMod_isDeleted == false select new RoleEntity { ModuleAccessTypeID = q.ModuleAccessTypeID, RMod_RoleID = q.RMod_RoleID, Mod_ModuleID = mm.Mod_ModuleID, Sub_ModuleID = q.Sub_ModuleID }).ToList(); return(response); } catch (Exception ex) { throw ex; } } }
public List <UserProfileEntity> GetSocialMediaByID(int ID) { List <UserProfileEntity> response = new List <UserProfileEntity>(); using (var db = new EvolutyzCornerDataEntities()) { try { response = (from q in db.UserSocialMediaProfiles where q.Usmp_UserID == ID select new UserProfileEntity { SocialMediaId = q.Usmp_SocialMediaId, Url = q.Url }).ToList(); // response.IsSuccessful = true; return(response); } catch (Exception ex) { return(response); } } }
public NewsboardEntity GetNewsById(int id) { using (var db = new EvolutyzCornerDataEntities()) { try { var query = (from q in db.NewsBoards join u in db.Users on q.CreatedBy equals u.Usr_UserID join up in db.UsersProfiles on u.Usr_UserID equals up.UsrP_UserID where q.NewsBoardId == id select new NewsboardEntity { NewsBoardId = q.NewsBoardId, Title = q.Title, Description = q.Description, Image = q.Image, Name = up.UsrP_FirstName + " " + up.UsrP_LastName, CreatedDate = q.CreatedDate, }).FirstOrDefault(); return(query); } catch (Exception ex) { return(null); } } }
public List <SkillEntity> GetSkillList(int id) { List <SkillEntity> response = new List <SkillEntity>(); using (var db = new EvolutyzCornerDataEntities()) { try { response = (from h in db.Skills where h.Acc_AccountID == id && h.Sk_isDeleted == false select new SkillEntity { SkillId = h.SkillId, SkillTitle = h.SkillTitle, }).ToList(); return(response); } catch (Exception ex) { return(null); } } }
public List <SkillEntity> GetAccountSkills(int accountID) { using (var db = new EvolutyzCornerDataEntities()) { try { var query = (from h in db.Skills join a in db.Accounts on h.Acc_AccountID equals a.Acc_AccountID where h.Acc_AccountID == accountID select new SkillEntity { SkillId = h.SkillId, SkillTitle = h.SkillTitle, ShortDescription = h.ShortDescription, Sk_isDeleted = h.Sk_isDeleted }).ToList(); return(query); } catch (Exception ex) { return(null); } } }
public List <UserProfileEntity> GetSocialmedia(int accountid, int userid) { List <UserProfileEntity> response = new List <UserProfileEntity>(); using (var db = new EvolutyzCornerDataEntities()) { try { response = (from h in db.UserSocialMediaProfiles where h.Usmp_UserID == userid && h.Url != null select new UserProfileEntity { SocialMediaId = h.Usmp_SocialMediaId, Url = "https://" + h.Url //Url = h.Url }).ToList(); for (int i = 0; i <= response.Count - 1; i++) { if (response[i].Url == "https://") { int?sid = response[i].SocialMediaId; var url = db.Set <SocialMedia>().Where(s => s.SocialMediaId == sid).FirstOrDefault <SocialMedia>().Url; response[i].Url = url; } } return(response); } catch (Exception ex) { return(null); } } }
public SkillEntity Getskillbyid(int id) { SkillEntity response = new SkillEntity(); using (var db = new EvolutyzCornerDataEntities()) { try { response = (from h in db.Skills where h.SkillId == id select new SkillEntity { SkillId = h.SkillId, SkillTitle = h.SkillTitle, ShortDescription = h.ShortDescription, Sk_isDeleted = h.Sk_isDeleted }).FirstOrDefault(); return(response); } catch (Exception ex) { return(null); } } }
public List <FinancialYearEntity> GetFinanacialYears() { UserSessionInfo info = new UserSessionInfo(); int accid = info.AccountId; using (var db = new EvolutyzCornerDataEntities()) { try { var response = (from ls in db.FinancialYears //where ls.IsDeleted== true select new FinancialYearEntity { FinancialYearId = ls.FinancialYearId, StartDate = ls.StartDate, //EndDate = ls.EndDate, financialyear = ls.StartDate + "" /*+ "-" + ls.EndDate*/, IsDeleted = ls.IsDeleted }).Distinct().ToList(); return(response); } catch (Exception ex) { return(null); } } }
public List <ProjectEntity> GetLoadProjects() { UserSessionInfo obj = new UserSessionInfo(); int objaccountid = obj.AccountId; using (var db = new EvolutyzCornerDataEntities()) { try { var query1 = (from p in db.Projects join up in db.UserProjects on p.Proj_ProjectID equals up.UProj_ProjectID join u in db.Users on up.UProj_UserID equals u.Usr_UserID join r in db.Roles on u.Usr_RoleID equals r.Rol_RoleID where p.Proj_AccountID == objaccountid select new ProjectEntity { Proj_ProjectID = p.Proj_ProjectID, Proj_ProjectName = p.Proj_ProjectName, }).GroupBy(n => new { n.Proj_ProjectID, n.Proj_ProjectName }) .Select(p => p.FirstOrDefault()).ToList(); return(query1); } catch (Exception ex) { return(null); } } }
public ActionResult ProjectAssign(string dropdown1, string dropdown2, string from, string To, string per) { EvolutyzCornerDataEntities DB = new EvolutyzCornerDataEntities(); Project_workstatus OBJ = new Project_workstatus(); OBJ.ProjectName = dropdown1; OBJ.UserName = dropdown2; OBJ.FromDT = Convert.ToDateTime(from); OBJ.ToDT = Convert.ToDateTime(To); OBJ.PercentageCompleted = per; DB.Project_workstatus.Add(OBJ); DB.SaveChanges(); return(Json(OBJ, JsonRequestBehavior.AllowGet)); }
public List <TaskLookupEntity> GetLookUpByEmpId(int Userid) { UserSessionInfo obj = new UserSessionInfo(); int objaccountid = obj.AccountId; int roleid = obj.RoleId; using (var db = new EvolutyzCornerDataEntities()) { try { var Roleid = db.Users.Where(d => d.Usr_UserID == Userid).FirstOrDefault().Usr_RoleID; var Roleid2 = db.Roles.Where(d => d.Rol_RoleID == Roleid).FirstOrDefault().Rol_RoleName; var query1 = (from UT in db.AccountSpecificTasks join cp in db.ClientProjectsTasks on UT.Acc_SpecificTaskId equals cp.acc_specifictaskid where cp.rol_roleid == Roleid2 && cp.Accountid == objaccountid select new TaskLookupEntity { tsk_TaskID = cp.acc_specifictaskid, tsk_TaskName = UT.Acc_SpecificTaskName }).ToList(); return(query1); } catch (Exception) { return(null); } } }
public List <AccountSpecifictasks> GetAllTasks() { UserSessionInfo info = new UserSessionInfo(); int accountId = info.AccountId; string RoleId = info.RoleName; try { if (RoleId == "Super Admin") { using (var db = new EvolutyzCornerDataEntities()) { var query = (from UT in db.AccountSpecificTasks join r in db.Accounts on UT.AccountID equals r.Acc_AccountID join GT in db.GenericTasks on UT.tsk_TaskID equals GT.tsk_TaskID select new AccountSpecifictasks { Acc_SpecificTaskId = UT.Acc_SpecificTaskId, AccountID = UT.AccountID, Acc_AccountName = r.Acc_AccountName, Acc_SpecificTaskName = UT.Acc_SpecificTaskName, tsk_TaskID = UT.tsk_TaskID, tsk_TaskName = GT.tsk_TaskName, //StatusId = UT.StatusId, isDeleted = UT.isDeleted, }).ToList(); return(query); } } else { using (var db = new EvolutyzCornerDataEntities()) { var query = (from UT in db.AccountSpecificTasks join r in db.Accounts on UT.AccountID equals r.Acc_AccountID join GT in db.GenericTasks on UT.tsk_TaskID equals GT.tsk_TaskID where r.Acc_AccountID == accountId select new AccountSpecifictasks { Acc_SpecificTaskId = UT.Acc_SpecificTaskId, AccountID = UT.AccountID, Acc_AccountName = r.Acc_AccountName, Acc_SpecificTaskName = UT.Acc_SpecificTaskName, tsk_TaskID = UT.tsk_TaskID, tsk_TaskName = GT.tsk_TaskName, //StatusId = UT.StatusId, isDeleted = UT.isDeleted, }).ToList(); return(query); } } } catch (Exception) { return(null); } }
public List <HolidayCalendarEntity> SelectHolidayDetail() { using (var db = new EvolutyzCornerDataEntities()) { try { var query = (from h in db.HolidayCalendars join a in db.Accounts on h.AccountID equals a.Acc_AccountID select new HolidayCalendarEntity { HolidayCalendarID = h.HolidayCalendarID, HolidayName = h.HolidayName, HolidayDate = h.HolidayDate, Year = h.Year, HolidayWeek = h.HolidayDate.DayOfWeek.ToString(), AccountID = h.AccountID, AccountName = a.Acc_AccountName, isActive = h.isActive, CreatedBy = h.CreatedBy, CreatedDate = h.CreatedDate, ModifiedBy = h.ModifiedBy, //ModifiedDate = h.ModifiedDate, isDeleted = h.isDeleted, }).OrderBy(x => x.AccountID).ThenBy(y => y.Year).ThenBy(z => z.HolidayDate).ToList(); return(query); } catch (Exception ex) { return(null); } } }
public int deletetaskbyid(int id) { int retVal = 0; AccountSpecificTask _taskDtl = null; User tasks = new User(); using (var db = new EvolutyzCornerDataEntities()) { try { tasks = db.Set <User>().Where(s => s.Usr_TaskID == id).FirstOrDefault <User>(); _taskDtl = db.Set <AccountSpecificTask>().Where(s => s.Acc_SpecificTaskId == id).FirstOrDefault <AccountSpecificTask>(); if (tasks != null) { return(retVal = 2); } if (_taskDtl == null) { return(retVal); } _taskDtl.isDeleted = true; db.Entry(_taskDtl).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); retVal = 1; } catch (Exception ex) { retVal = -1; } } return(retVal); }
public List <LeaveTypeEntity> GetHolidayDates(int accountid) { try { using (var db = new EvolutyzCornerDataEntities()) { var query = (from h in db.HolidayCalendars join a in db.Accounts on h.AccountID equals a.Acc_AccountID where h.AccountID == accountid select new LeaveTypeEntity { HolidayCalendarID = h.HolidayCalendarID, HolidayName = h.HolidayName, HolidayDate = h.HolidayDate, //Year = h.Year, //AccountID = h.AccountID, //AccountName = a.Acc_AccountName, //isOptionalHoliday = h.isOptionalHoliday, //isActive = h.isActive, //CreatedBy = h.CreatedBy, //CreatedDate = h.CreatedDate, //ModifiedBy = h.ModifiedBy, //ModifiedDate = h.ModifiedDate, //isDeleted = h.isDeleted, }).ToList(); return(query); } } catch (Exception ex) { return(null); } }
public ActionResult DeleteSkills(int id) { try { UserProjectdetailsEntity sessId = new UserProjectdetailsEntity(); int userID = sessId.User_ID; EvolutyzCornerDataEntities evolutyzData = new EvolutyzCornerDataEntities(); UserSkill skills = evolutyzData.UserSkills.SingleOrDefault(u => u.Usr_UserId == id); if (userID == id) { evolutyzData.UserSkills.Remove(skills); evolutyzData.SaveChanges(); return(Json("Removed Successfully", JsonRequestBehavior.AllowGet)); } else { return(Json("Deletion Failed and Please Try Again", JsonRequestBehavior.AllowGet)); } } catch (Exception) { throw; } }
public List <QuestionsEntity> DisplayTechnologyQuestions() { List <QuestionsEntity> query = new List <QuestionsEntity>(); using (var db = new EvolutyzCornerDataEntities()) { try { query = (from u in db.QuestionBanks select new QuestionsEntity { Question1 = u.Question, Option1 = u.Option1, Option2 = u.Option2, Option3 = u.Option3, Option4 = u.Option4, Title = (from em in db.TechnologyStacks.Where(x => x.TID == u.TechnologyStackId) select em.Title).FirstOrDefault(), Qid = u.QBID }).ToList(); } catch (Exception ex) { throw ex; } return(query); } }