Files
BeWoPlaner/BeWoPlanerMobil/Models/CustomerModel.cs
Lyndon Jetten 1850c1bdfe Verbesserungen im ownChat.
JsonCustomer.cs hinzugefügt, sodass der Klient wieder in der Mobilversion angezeigt werden kann.
2020-04-16 15:57:01 +02:00

33 lines
1.1 KiB
C#

using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
using BeWoPlanerMobil.Util;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Compact;
namespace BeWoPlanerMobil.Models
{
public class CustomerModel : AbstractModel
{
[Display(Name = "Klient")]
public long? SelectedCustomerOid { get; set; }
public CustomerDC SelectedCustomer { get; set; }
public List<CompactCustomerDC> Customers { get; set; }
public IEnumerable<SelectListItem> CustomerListItems
{
get
{
var result = new List<SelectListItem> { new SelectListItem { Value = "-1", Text = string.Empty } };
result.AddRange(Customers.Select(item => new SelectListItem { Value = item.CustomerOid.ToString(), Text = string.Format("{1}, {0}", item.FirstName, item.LastName) }).ToList());
return result;
}
}
public JsonCustomer SelectedJsonCustomer => SelectedCustomer != null ? new JsonCustomer(SelectedCustomer) : null;
}
}