Skip to content

Commit

Permalink
Add Viewmodels
Browse files Browse the repository at this point in the history
  • Loading branch information
amos-cha committed Jun 24, 2024
1 parent 63bb609 commit 53fb537
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Gordon360/Models/ViewModels/PosterPatchViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Gordon360.Models.CCT;
using System;

namespace Gordon360.Models.ViewModels;

public class PosterPatchViewModel
{
public string? Title { get; set; }
public string? Description { get; set; }
public string? ImagePath { get; set; }
public DateTime? VisibleDate { get; set; }
public DateTime? ExpirationDate { get; set; }
public string? Status { get; set; }

}
32 changes: 32 additions & 0 deletions Gordon360/Models/ViewModels/PosterViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Gordon360.Models.CCT;
using System;

namespace Gordon360.Models.ViewModels;

public class PosterViewModel
{
public string ClubCode { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string ImagePath { get; set; }
public DateTime VisibleDate { get; set; }
public DateTime ExpirationDate { get; set; }
public string Status { get; set; }


public static implicit operator PosterViewModel(Poster p)
{
PosterViewModel vm = new PosterViewModel
{
ClubCode = p.ACT_CDE.Trim(),
Title = p.Title,
Description = p.Description ?? "",
ImagePath = p.ImagePath,
VisibleDate = p.VisibleDate,
ExpirationDate = p.ExpirationDate,
Status = p.Status.Status
};

return vm;
}
}

0 comments on commit 53fb537

Please sign in to comment.