public IEnumerable <JobModel> GetUsers(int id) { List <JobModel> lpm = new List <JobModel>(); List <Folder> folders = new List <Folder>(); List <JobRequest> jobs = new List <JobRequest>(); folders = serviceFolder.GetAll().Where(a => a.etape == 3).ToList(); foreach (var item in folders) { jobs = cs.GetAll().Where(a => a.offerId == id).ToList(); } foreach (var item in jobs) { JobModel jobModel = new JobModel(); jobModel.dateApply = item.userId; jobModel.speciality = item.speciality; jobModel.userId = item.userId; jobModel.jobRequestId = item.jobRequestId; jobModel.state = item.state; lpm.Add(jobModel); } return(lpm); }
// GET: Attachment public ActionResult Index() { JobRequest jobrequest = serviceJobRequest.GetAll().Where(a => a.userId == User.Identity.GetUserId <int>()).SingleOrDefault(); Folder folder = serviceFolder.GetAll().Where(a => a.jobRequestId == jobrequest.jobRequestId).SingleOrDefault(); List <AttachmentModel> list = new List <AttachmentModel>(); foreach (var item in serviceAttachment.GetAll().Where(a => a.folderId == folder.folderId)) { AttachmentModel attachmentModel = new AttachmentModel(); attachmentModel.typeAttachment = item.typeAttachment; attachmentModel.lienAttachment = item.lienAttachment; attachmentModel.attachmentId = item.attachmentId; attachmentModel.approved = item.proved; list.Add(attachmentModel); } return(View(list)); }
public async Task <ActionResult> Index() { BigViewModel big = new BigViewModel(); //get details user Connec string username = User.Identity.GetUserName(); User user = await UserManager.FindByEmailAsync(username); UserModel model = new UserModel(); model.userId = user.Id; model.address = user.address; model.Email = user.Email; model.firstname = user.firstname; model.lastname = user.lastname; model.phoneNumber = user.PhoneNumber; big.resourceViewModel = model; ////////////////////// JobRequest jobrequest = serviceJobRequest.GetAll().Where(a => a.userId == User.Identity.GetUserId <int>()).SingleOrDefault(); Folder folder = serviceFolder.GetAll().Where(a => a.jobRequestId == jobrequest.jobRequestId).SingleOrDefault(); FolderViewModel folerModel = new FolderViewModel(); folerModel.folderId = folder.folderId; folerModel.typeTest = folder.typeTest; folerModel.testResult = folder.testResult; folerModel.state = folder.state; folerModel.etape = folder.etape; big.folderViewModel = folerModel; return(View(big)); }
public async Task <ActionResult> UsersByOffer(int id) { List <BigViewModel> list = new List <BigViewModel>(); List <Folder> folders = new List <Folder>(); List <JobRequest> jobs = new List <JobRequest>(); folders = serviceFolder.GetAll().Where(a => a.etape == 3).ToList(); foreach (var item in folders) { jobs = serviceJob.GetAll().Where(a => a.offerId == id && a.jobRequestId == item.jobRequestId).ToList(); } foreach (var item in jobs) { User user = await UserManager.FindByIdAsync(item.userId); UserModel userModel = new UserModel(); userModel.firstname = user.firstname; userModel.lastname = user.lastname; userModel.Email = user.Email; userModel.userId = user.Id; JobRequestModel jobModel = new JobRequestModel(); jobModel.dateApply = item.dateApply; jobModel.speciality = item.speciality; jobModel.userId = item.userId; jobModel.jobRequestId = item.jobRequestId; jobModel.state = item.state; // Resource user1 = serviceResouce.getResource(user.UserName); BigViewModel bg = new BigViewModel(); bg.resourceViewModel = userModel; bg.jobRequestModel = jobModel; list.Add(bg); } return(View(list)); }
public IHttpActionResult GetFolder(int id) { JobRequest jobrequest = serviceJob.GetAll().Where(a => a.userId == id).SingleOrDefault(); Folder folder = serviceFolder.GetAll().Where(a => a.jobRequestId == jobrequest.jobRequestId).SingleOrDefault(); FolderViewModel folerModel = new FolderViewModel(); folerModel.folderId = folder.folderId; folerModel.typeTest = folder.typeTest; folerModel.testResult = folder.testResult; folerModel.state = folder.state; folerModel.etape = folder.etape; if (folder == null) { return(NotFound()); } return(Ok(folerModel)); }