30 lines
968 B
C#
30 lines
968 B
C#
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|