Skip to content

Instantly share code, notes, and snippets.

@philipusis
Created October 6, 2017 00:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philipusis/8c4603531b054478a3096e082cd595a7 to your computer and use it in GitHub Desktop.
Save philipusis/8c4603531b054478a3096e082cd595a7 to your computer and use it in GitHub Desktop.
public ActionResult Index()
{
IndexModel model = new IndexModel();
model.PsyUserVacancyStatus = EnumObjects.GetPsyUserVacancyStatus(Language.Russian);
model.DownloadPath = downloadPath;
model.PsyTestUser = unitOfWork.PsyTestUser.GetPsyTestUser(currUser.PsyTestUserId);
model.Vacancies = unitOfWork.Vacancy.GetVacanciesByUser(currUser.PsyTestUserId);
model.PsyTestLinks = unitOfWork.PsyTestLink.GetPsyTestLinksByUser(currUser.PsyTestUserId);
List<int> ids = model.PsyTestLinks.Select(x => x.InquirerId).ToList();
model.Inquirers = unitOfWork.Inquirer.GetInquirersByIds(ids, currUser.PsyTestUserId, Language.Russian);
model.UserImagePath = downloadPath + "PsyUserImage/" + currUser.PsyTestUserId + ".png";
var messages = unitOfWork.MessagePsyUserAndUser.GetAllMessagesByPsyUserId(currUser.PsyTestUserId);
List<PsyUserMessageModel> viewMessages = new List<PsyUserMessageModel>();
foreach (var message in messages)
{
var vm = new PsyUserMessageModel();
vm.MessageId = message.MessageId;
vm.Body = message.Body;
vm.CreationTime = message.CreationTime;
vm.PsyTestUserC = unitOfWork.PsyTestUser.GetPsyTestUser(message.PsyTestUserId);
vm.UserC = unitOfWork.User.GetUser(message.UserId);
vm.UserC.Filds = unitOfWork.Fild.GetByUser(message.UserId, vm.UserC.CompanyId, OnlySystemData.Helper.Language.Russian);
vm.Type = message.Type;
viewMessages.Add(vm);
}
model.Messages = viewMessages;
model.Activity = unitOfWork.PsyTestUserActivity.GetByPsyTestUserId(currUser.PsyTestUserId);
string path = "PsyUserCV/" + currUser.PsyTestUserId.ToString();
FtpClient ftpClient = new FtpClient(ftpUploadPath, ftpUser, ftpPassword);
var allfiles = ftpClient.directoryListSimple(path);
if (allfiles.Count > 0)
{
model.UserCVPath = downloadPath + path + "/" + allfiles[0];
model.UserCVFileName = allfiles[0];
}
return View(model);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment