Denmark Puso

Denmark Puso

  • NA
  • 232
  • 50.7k

Sorting not working

Jul 20 2019 12:03 AM
im trying to sort  state, city and town but my code is not working plss help 
 
if (model.Id > 0)
{
var order = _orderService.Get(model.Id);
model.ClientId = order.ClientId;
model.StateId = order.StateId;
model.CityId = order.CityId;
model.TownId = order.TownId;
model.Postcode = order.Postcode;
model.Address = order.Address;
model.DeliveryDate = order.DeliveryDate;
model.Quantity = order.Quantity;
model.Notes = order.Notes;
model.Status = order.Status;
model.States = _stateService.GetStatesByCountryId(order.Client.CountryId).Select(x => new SelectListItem
{
Text = x.Name,
Value = x.Id.ToString()
}).OrderBy(x => x.Text);
model.Cities = _cityService.GetCitiesByStateId(order.StateId).Select(x => new SelectListItem
{
Text = x.Name,
Value = x.Id.ToString()
}).OrderBy(x => x.Text);
model.Towns = _townService.GetTownsByCityId(order.CityId).Select(x => new SelectListItem
{
Text = x.Name,
Value = x.Id.ToString()
}).OrderBy(x => x.Text);
}
return model;

Answers (1)