Files
BeWoPlaner/BeWoPlanerMobil/Models/CustomerModel.cs

30 lines
968 B
C#
Raw Normal View History

2019-07-25 14:58:13 +02:00
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web.Mvc;
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;
}
}
}
}