public ActionResult UpdateStyleTraitValueSortOrders(Guid StyleTraitID, List <VariantValueModel> StyleTraitValueSortOrders) { try { foreach (var StyleTraitValueSortOrder in StyleTraitValueSortOrders) { _db.UpdateStyleTraitValueSortOrder(StyleTraitValueSortOrder.ID, StyleTraitValueSortOrder.SortOrder, _UserName); } var Model = new List <VariantValueModel>(); var StyleTraitValues = _db.GetStyleTraitValues(StyleTraitID); Model = (from av in StyleTraitValues select new Models.VariantValueModel() { ID = av.StyleTraitValueID, Value = av.StyleTraitValue, Selected = false, SortOrder = av.StyleTraitValueSortOrder ?? 0 }).ToList(); return(Json(new { Status = "Successful", Count = Model.Count(), StyleTraitValues = Model })); } catch (Exception ex) { LoggingHelper.LogError(ex); return(Json(new { Status = "Error", Message = ex.Message })); } }