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 8527153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:28:32+00:00 2026-06-11T08:28:32+00:00

The system has a page where the user can search through items by specifying

  • 0

The system has a page where the user can search through items by specifying a start date and end date. These are plain dates (Without the time component). For the user it seems most intuitive for the end date to be inclusive (so include all items for that end date as well).

The CreateDate of the items however does contain a time component in the data store. In practice this means that we need to translate this timeless end date to a 0:00:00 hour date for the next day. This way we can write the following query:

SELECT *
FROM   Items 
WHERE  CreateDate >= @STARTDATE
AND    CreateDate < @ENDDATE

Transforming this end date is as easy as writing this line of code:

endDate.Date.AddDays(1);

Nou my question is:

should I consider this last line of code business logic and should it be placed in the Business Layer, or should I consider this line a piece of ‘model binding logic’ and should it be placed in the Presentation Layer?

When it is placed it in the BL, this means that the BL knows about the presentation layer, since the way the value is supplied is something that is interface specific. On the other hand, since the operation is defined as a DTO in the business layer, I could also see this object as interface that should be convenient for the presentation layer.

This question might even be philosofical in nature, since there are probably multiple ways to look at this, and the actual conversion code is trivial. I’m interested to hear why you think it should be placed in one layer and not in the other.

I don’t expect the application’s architecture should have any effect on the answer to this question. But to give a more complete picture, the architecture is based on commands and queries and the presentation layer creates a query object that are handled by the business layer. The PL code would typically look like this:

public Action Filter(DateTime start, DateTime end)
{
    var query = new GetItemsByStartEndEndDateQuery
    {
        StartDate = start.Date,
        EndDate = end.Date.AddDays(1)
    }

    var items = this.queryProcessor.Handle(query);

    return this.View(items);
}

Or when possible, (MVC) model binding is used to simply model bind the command and query objects (which is very convenient):

public Action Filter(GetItemsByStartEndEndDateQuery query)
{
    var items = this.queryProcessor.Handle(query);

    return this.View(items);
}

Would your answer change when there are multiple users involded (a WCF layer and a MVC layer, for instance)?

  • 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-11T08:28:34+00:00Added an answer on June 11, 2026 at 8:28 am

    There should be a contract for the semantics of the service exposed by your business layer, and probably automated tests for that contract.

    This contract should define how the input arguments are interpreted and validated, for example:

    • What is the result if StartDate > EndDate?
    • What range of dates is acceptable (e.g. what about dates earlier than 1/1/1753 with SQL Server)?
    • Are input parameters allowed to have non-zero time of day components, and if so how is the time of day handled (truncate and use date only; throw an exception if the caller includes a time of day component; or allow caller to specify a range that includes a time of day component).
    • Is the range exclusive or inclusive?
    • How are time zones handled (e.g. date parameters with Kind = Local, Utc or Unspecified)?

    If this contract doesn’t match the way the presentation layer wants to get input from the user, then it’s OK for the presentation layer to do the mapping to match the contract.

    And of course, if the contract does not match the way the data access layer expects the date range, the business layer can do the mapping to whatever the data access layer expects.

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

Sidebar

Related Questions

/* * Each physical page in the system has a struct page associated with
My search system has two main parts: index and search. I want to make
How can I detect if my system has received a new IP address? My
I am currently developing an order system where the user can select which day
I am building a faceted search system that has inputs in a sidebar (the
Here's the situation. Multi-million user website. Each user's page has a message section. Anyone
I have a page on my MVC application where a user can edit /
I have created Facebook registration page, What i want to do is user can
I am currently building a dynamic url tab system that user can say what
I'm trying to create a rating system, where the user can rate pictures/videos/audio etc.

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.