public MaterialActiveDestributionModel(Data.Entities.MaterialActive source, List <Data.Entities.Person> persons, List <Data.Entities.LocationPlace> locationPlaces) { Id = source.Id; FullCode = source.ActiveType.TypeCode + source.Code; Name = source.Name; Status = source.Status; PersonItems = new List <SelectListItem>(); foreach (var item in persons) { PersonItems.Add(new SelectListItem { Value = item.Id.ToString(), Text = item.FullName }); } LocationPlaceItems = new List <SelectListItem>(); foreach (var item in locationPlaces) { LocationPlaceItems.Add(new SelectListItem { Value = item.Id.ToString(), Text = item.LocationName }); } }
public MaterialActiveViewModel(Data.Entities.MaterialActive source) { Id = source.Id; ActiveType = source.ActiveType; Code = source.Code; Name = source.Name; Manufacturer = source.Manufacturer; IncomeSource = source.IncomeSource; IncomeDate = source.IncomeDate.HasValue? source.IncomeDate.Value.ToString("dd.MM.yyyy"): ""; StartUseDate = source.StartUseDate.HasValue ? source.StartUseDate.Value.ToString("dd.MM.yyyy") : ""; AmmortizateDate = source.AmmortizateDate.HasValue ? source.AmmortizateDate.Value.ToString("dd.MM.yyyy") : ""; StopUseDate = source.StopUseDate.HasValue ? source.StopUseDate.Value.ToString("dd.MM.yyyy") : ""; ResponsiblePerson = source.ResponsiblePerson; OwnerPerson = source.OwnerPerson; Price = source.Price; LocationPlace = source.LocationPlace; Status = source.Status; IsDeleted = source.IsDeleted; Specifications = source.ActiveSpecifications.ToList(); }