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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:21:18+00:00 2026-06-13T10:21:18+00:00

Attempting to database driven website for video rentals So I have two tables in

  • 0

Attempting to database driven website for video rentals

So I have two tables in my database (movie, and rental),
I have a column set in each table ‘OnHire’ which has the data value of ‘bit’
with NULL values selected.

So I have all the CRUD features working but…

When the user creates a new rental record in the rental table and turns ‘OnHire’ to true
I am trying to use a bool which will then turn the ‘OnHire’ in movies to true.

Allowing the user to know by looking at the movies table whether it is on hire or not
it is telling me i cant convert a type bool? to bool, a conversion exists(are you missing a cat)?

HttpPost]
    public ActionResult Create(Rental rentals)
    {
        try
        {
            // TODO: Add insert logic here
            _entities.AddToRentals(rentals);
            _entities.SaveChanges();

            Movie mov = new Movie();

            if (rentals.OnHire)
            {
                mov.OnHire = true;
            }
            else
            {
                mov.OnHire = false;
            }

            return RedirectToAction("Index");
        }
        catch
        {
            return View();
        }
    }

Then I am probably pushing my luck here but if that is successfull I was going to do the opposite and throw an error message if the user tries to hire out a video already on hire

            if (mov.OnHire)
            {
                //error message
            }

Any suggestions?

Also on completion of the CRUD for database I was looking to implement a search feature?

  • 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-13T10:21:19+00:00Added an answer on June 13, 2026 at 10:21 am

    You should use rentals.OnHire == true instead of rentals.OnHire.

    if (rentals.OnHire == true)
    {
        mov.OnHire = true;
    }
    else
    {
        mov.OnHire = false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to submit a large database containing many tables to a web service
The database table only contains the four fields that the query is attempting to
I have a mySQL database that tracks our projects and drives our website's display
I building a simple, 7 page, database driven, website, and I would like to
I'm attempting to write a search function for a database table that needs to
I’m attempting to use ADO.NET Data Services to update my database. Tables: Person( PK
I'm attempting to migrate a database with a SQL file I was provided. However,
I am attempting to use a SQLite database to store emails locally in android.
I am attempting to drop and recreate a database from my CI setup. But
I'm attempting to copy the database located, as an example, in: /data/data/com.x.x.x/databases/mydb.db This works

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.