public PostPreviewModel(Data.Entities.Models.Post post) { Id = post.Id; Title = post.Title; PhotoPath = post.PhotoPath; Timestamp = post.DateTime; ContentPreview = FileHelpers.ReadFirstFewChars(post.ContentPath, 250); }
public PostModel(Data.Entities.Models.Post post, Data.Entities.Models.Shelter shelter) { Title = post.Title; PhotoPath = post.PhotoPath; Timestamp = post.DateTime; ShelterName = shelter.Name; ShelterId = shelter.Id; var serverPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", post.ContentPath); Content = File.ReadAllText(serverPath); }