public static PpeTypeInfo Project(NeedPpeTypeViewModel s)
 {
     return(new PpeTypeInfo {
         Selected = s.Selected,
         DailyShortage = s.DailyShortage
     });
 }
        public static List <NeedPpeTypeViewModel> FromNeed(Need s)
        {
            List <NeedPpeTypeViewModel> respVal     = new List <NeedPpeTypeViewModel>();
            List <NeedPpeTypeViewModel> chosenItems = s.NeedPpeTypes.SelectToList(NeedPpeTypeViewModel.FromEntity);
            List <NeedPpeTypeViewModel> fullList    = Enums.AllList <PpeTypes>().SelectToList(NeedPpeTypeViewModel.FromPpeType);

            foreach (NeedPpeTypeViewModel emptyOption in fullList)
            {
                NeedPpeTypeViewModel existing = chosenItems.SingleOrDefault(p => p.Type == emptyOption.Type);
                respVal.Add(existing ?? emptyOption);
            }
            return(respVal);
        }
예제 #3
0
 public static NeedsViewModel FromEntity(Need s)
 {
     return(new NeedsViewModel
     {
         Id = s.Id,
         PublishAnonymously = s.PublishAnonymously,
         ContactName = s.ContactName,
         Email = s.Email,
         PhoneNumber = s.PhoneNumber,
         OrganisationName = s.OrganisationName,
         OrgType = (OrgTypes)s.OrgTypeId,
         OrgTypeOther = s.OrgTypeOther,
         Postcode = s.Postcode,
         JobTitle = s.JobTitle,
         Department = s.Department,
         TownOrCity = s.TownOrCity,
         TellUsMore = s.TellUsMore,
         PpeTypes = NeedPpeTypeViewModel.FromNeed(s)
     });
 }