ServiceEditModel.cs 694 B

1234567891011121314151617181920212223242526
  1. using RackPeek.Domain.Resources.Services;
  2. namespace RackPeek.Web.Components.Components;
  3. public sealed class ServiceEditModel
  4. {
  5. public string Name { get; init; } = default!;
  6. public string? Ip { get; set; }
  7. public int? Port { get; set; }
  8. public string? Protocol { get; set; }
  9. public string? Url { get; set; }
  10. public string? RunsOn { get; set; }
  11. public static ServiceEditModel From(Service s)
  12. {
  13. return new ServiceEditModel
  14. {
  15. Name = s.Name,
  16. Ip = s.Network?.Ip,
  17. Port = s.Network?.Port,
  18. Protocol = s.Network?.Protocol,
  19. Url = s.Network?.Url,
  20. RunsOn = s.RunsOn
  21. };
  22. }
  23. }