Beispiel #1
0
 public PetSuccessStoryViewModel PetSuccessStoryToViewModel(PetSuccessStory data)
 {
     return(new PetSuccessStoryViewModel
     {
         OwnerFullName = HttpUtility.HtmlDecode(data.OwnerFullName),
         OwnerProfileImageUrl = data.OwnerProfileImageUrl,
         PetName = HttpUtility.HtmlDecode(data.PetName),
         PetProfileImageUrl = data.PetProfileImageUrl,
         FoundComment = HttpUtility.HtmlDecode(data.FoundComment),
         LostDateTime = data.LostDateTime.ToString("dd / MMM / yyyy hh:mm:ss tt"),
         FoundDateTime = data.FoundDateTime.ToString("dd / MMM / yyyy hh:mm:ss tt")
     });
 }
Beispiel #2
0
        private List <PetSuccessStory> FormatPetSuccessStories(List <Tuple <PetAlertTableModel, PetTableModel, OwnerTableModel, PetImageTableModel> > records)
        {
            var result = new List <PetSuccessStory>();

            PetSuccessStory petSuccessStory;

            foreach (var item in records)
            {
                petSuccessStory = new PetSuccessStory
                {
                    OwnerFullName        = $"{item.Item3.FirstName} {item.Item3.LastName}",
                    OwnerProfileImageUrl = item.Item3.ProfileImageUrl,
                    PetName            = item.Item2.Name,
                    PetProfileImageUrl = item.Item4.ImageUrl,
                    FoundComment       = item.Item1.CommentFound,
                    LostDateTime       = item.Item1.CreatedOn,
                    FoundDateTime      = item.Item1.SolvedOn.Value
                };

                result.Add(petSuccessStory);
            }

            return(result);
        }