public List <SelectListItem> GetSaleOrderForSelectList(Guid?id) { List <SelectListItem> selectListItem = null; List <SaleOrder> saleOrderList = _saleOrderRepository.GetSaleOrderForSelectList(id); return(selectListItem = saleOrderList != null ? (from saleOrder in saleOrderList select new SelectListItem { Text = saleOrder.SaleOrderNo, Value = saleOrder.ID.ToString(), Selected = false }).ToList() : new List <SelectListItem>()); }