Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8954485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:19:41+00:00 2026-06-15T14:19:41+00:00

I m having a little trouble coming up with a schema to order and

  • 0

I m having a little trouble coming up with a schema to order and changing order in a article/news management system.

Here goes:
I have News Object Model as follow:

 class News {
   int id;
   string Title;
   string Content;
   string OrderId;
   // trimmed
 }

I have CRUD for the object model. and List as follows:

Id Title Order
1. Foo    -+
2. Bar    -+
3. Glah   -+

What i want to do is when user clicks on – for first news, i want to replace 1 and 2 orderid and of course display as well.

well how do i do this on server side? lets say for 1. item order id is 1 , how do i find the first item that has a higher order id then this one?

Or take 2. Bar, when i click on – , how do i find/replace order ids with first one. or i click on + how do i replace order id of this news with 3. Glah ?

is there a better way of doing this?

There are also some UI where user drags and drops ? any pointers on that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:19:42+00:00Added an answer on June 15, 2026 at 2:19 pm

    When the user changes the location of an item, the server needs to know which item was changed and what it’s new position is. In the code below, I’m using a List to figure out the new positons. In this sample code, newPosition is the new zero-based position and selectedArticle is the article that was moved.

    List<Article> articles = LoadSortedArticles()
    articles.Remove(selectedArticle);
    articles.Insert(newPosition, selectedArticle);
    UpdateArticles(articles);
    

    After running, the article’s index within the list tells you its new position. That applies to all articles in the list and works the same for a drag/drop UI. I don’t know entity framework, but if you can map the orderId field in the database to the index of the article in the list, then you should be good to go.

    I hope this is at least able to give you some ideas. Maybe someone else can give a solution specific to entity framework, but I think putting the articles into a sorted list and letting the list do the work might be the easiest way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a little trouble defining my question. Here's what I have. A mailto
I am having a little trouble trying to accomplish this. Here is the gist
Im having a little trouble setting up routes. I have a 'users' controller/model/views set
I am having a little trouble with building my criteria object. Normally, I Build
I am having a little trouble understanding migrations in Ruby on Rails. I have
I'm having a little trouble getting erlang to give me a unicode string. Here's
I have having a little trouble wrapping my head around the design pattern for
I'm having a little trouble overloading methods in C#. I have two methods that
I have having a little trouble with my project. I have a textfield which
I'm having a little trouble with my MYSQL query I have a DB full

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.