Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Apr 8th, 2020 204 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. namespace DotNetInterview.Web.ViewModels.Administration.Interviews
  2. {
  3.     using System.Collections.Generic;
  4.     using System.Globalization;
  5.  
  6.     using AutoMapper;
  7.     using DotNetInterview.Common;
  8.     using DotNetInterview.Data.Models;
  9.     using DotNetInterview.Data.Models.Enums;
  10.     using DotNetInterview.Services.Mapping;
  11.  
  12.     public class DetailsDeletedInterviewVM : IMapFrom<Interview>, IHaveCustomMappings
  13.     {
  14.         public DetailsDeletedInterviewVM()
  15.         {
  16.             this.Questions = new List<DetailsDeletedInterviewQuestionsVM>();
  17.             this.Comments = new List<DetailsDeletedCommentsVM>();
  18.         }
  19.  
  20.         public string UserId { get; set; }
  21.  
  22.         public string UserFullName { get; set; }
  23.  
  24.         public string InterviewId { get; set; }
  25.  
  26.         public string Seniority { get; set; }
  27.  
  28.         public string PositionTitle { get; set; }
  29.  
  30.         public string PositionDescription { get; set; }
  31.  
  32.         public string LocationType { get; set; }
  33.  
  34.         public string ShowLocation { get; set; }
  35.  
  36.         public string InterviewLocation { get; set; }
  37.  
  38.         public string CompanyNationality { get; set; }
  39.  
  40.         public string CompanySize { get; set; }
  41.  
  42.         public string CreatedOn { get; set; }
  43.  
  44.         public string DeletedOn { get; set; }
  45.  
  46.         public int Likes { get; set; }
  47.  
  48.         public string HideAddCommentForm => "hidden";
  49.  
  50.         public string CanEdit => "hidden";
  51.  
  52.         public string CanDelete => "hidden";
  53.  
  54.         public string CanHardDelete => "hidden";
  55.  
  56.         public string Deleted => "Deleted";
  57.  
  58.         public IEnumerable<DetailsDeletedInterviewQuestionsVM> Questions { get; set; }
  59.  
  60.         public IEnumerable<DetailsDeletedCommentsVM> Comments { get; set; }
  61.  
  62.         public void CreateMappings(IProfileExpression configuration)
  63.         {
  64.             configuration.CreateMap<Comment, DetailsDeletedCommentsVM>()
  65.                 .ForMember(c => c.ParentId, opt => opt.MapFrom(c => c.Id))
  66.                 .ForMember(c => c.CreatedOn, opt => opt.MapFrom(c => c.CreatedOn.ToLocalTime().ToString(GlobalConstants.FormatDate, CultureInfo.InvariantCulture)))
  67.                 .ForMember(c => c.DeletedOn, opt => opt.MapFrom(c => c.DeletedOn != null ? c.DeletedOn.Value.ToLocalTime().ToString(GlobalConstants.FormatDate, CultureInfo.InvariantCulture) : null))
  68.                 .ForMember(c => c.UserId, opt => opt.MapFrom(c => c.UserId))
  69.                 .ForMember(c => c.UserFullName, opt => opt.MapFrom(c =>
  70.                 string.IsNullOrWhiteSpace(c.User.LastName)
  71.                     ? c.User.FirstName.Length <= 20
  72.                         ? c.User.FirstName
  73.                         : c.User.FirstName.Substring(0, 17) + "..."
  74.                      : (c.User.FirstName + " " + c.User.LastName.Substring(0, 1).ToUpper() + ".").Length <= 20
  75.                          ? c.User.FirstName + " " + c.User.LastName.Substring(0, 1).ToUpper() + "."
  76.                          : (c.User.FirstName + " " + c.User.LastName.Substring(0, 1).ToUpper()).Substring(0, 17) + "..."));
  77.  
  78.             configuration.CreateMap<Question, DetailsDeletedInterviewQuestionsVM>()
  79.                 .ForMember(q => q.Answer, opt => opt.MapFrom(q => q.GivenAnswer))
  80.                 .ForMember(q => q.HideAnswer, opt => opt.MapFrom(q => q.GivenAnswer != null ? string.Empty : "hidden"))
  81.                 .ForMember(q => q.Ranked, opt => opt.MapFrom(q => q.RankType.ToString()))
  82.                 .ForMember(q => q.HideRanked, opt => opt.MapFrom(q => q.RankType != QuestionRankType.None ? string.Empty : "hidden"))
  83.                 .ForMember(q => q.CreatedOn, opt => opt.MapFrom(q => q.CreatedOn.ToLocalTime()
  84.                 .ToString(GlobalConstants.FormatDate, CultureInfo.InvariantCulture)))
  85.                 .ForMember(q => q.DeletedOn, opt => opt.MapFrom(q => q.DeletedOn != null
  86.                 ? q.DeletedOn.Value.ToLocalTime().ToString(GlobalConstants.FormatDate, CultureInfo.InvariantCulture) : null))
  87.                 .ForMember(q => q.File, opt => opt.MapFrom(q => q.UrlTask))
  88.                 .ForMember(q => q.HideFile, opt => opt.MapFrom(q => !string.IsNullOrEmpty(q.UrlTask) ? string.Empty : "hidden"))
  89.                 .ForMember(q => q.Comments, opt => opt.MapFrom(q => q.Comments));
  90.  
  91.             configuration.CreateMap<Interview, DetailsDeletedInterviewVM>()
  92.                 .ForMember(i => i.InterviewId, opt => opt.MapFrom(i => i.Id))
  93.                 .ForMember(i => i.UserFullName, opt => opt.MapFrom(i =>
  94.                 string.IsNullOrWhiteSpace(i.User.LastName)
  95.                     ? i.User.FirstName.Length <= 20
  96.                         ? i.User.FirstName
  97.                         : i.User.FirstName.Substring(0, 17) + "..."
  98.                      : (i.User.FirstName + " " + i.User.LastName.Substring(0, 1).ToUpper() + ".").Length <= 20
  99.                          ? i.User.FirstName + " " + i.User.LastName.Substring(0, 1).ToUpper() + "."
  100.                          : (i.User.FirstName + " " + i.User.LastName.Substring(0, 1).ToUpper()).Substring(0, 17) + "..."))
  101.                 .ForMember(i => i.Seniority, opt => opt.MapFrom(i => i.Seniority.ToString()))
  102.                 .ForMember(i => i.PositionDescription, opt => opt.MapFrom(i => i.PositionDescription != null ? i.PositionDescription : GlobalConstants.NoDescription))
  103.                 .ForMember(i => i.LocationType, opt => opt.MapFrom(i => i.LocationType.ToString()))
  104.                 .ForMember(i => i.ShowLocation, opt => opt.MapFrom(i =>
  105.                 i.LocationType == Data.Models.Enums.LocationType.InOffice
  106.                 ? string.Empty : "hidden"))
  107.                 .ForMember(i => i.InterviewLocation, opt => opt.MapFrom(i => i.HeldOnInterviewLocation))
  108.                 .ForMember(i => i.CompanySize, opt => opt.MapFrom(i => i.Employees.ToString()))
  109.                 .ForMember(i => i.CreatedOn, opt => opt.MapFrom(i => i.CreatedOn.ToLocalTime().ToString(GlobalConstants.FormatDate, CultureInfo.InvariantCulture)))
  110.                 .ForMember(i => i.DeletedOn, opt => opt.MapFrom(i => i.DeletedOn != null ? i.DeletedOn.Value.ToLocalTime().ToString(GlobalConstants.FormatDate, CultureInfo.InvariantCulture) : null))
  111.                 .ForMember(i => i.Likes, opt => opt.MapFrom(i => i.Likes.Count))
  112.                 .ForMember(i => i.Comments, opt => opt.MapFrom(i => i.Comments))
  113.                 .ForMember(i => i.Questions, opt => opt.MapFrom(i => i.Questions));
  114.         }
  115.     }
  116. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top