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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:46:07+00:00 2026-06-11T04:46:07+00:00

I am a newbie in ASP.NET MVC and learning from zero now by reading

  • 0

I am a newbie in ASP.NET MVC and learning from zero now by reading the tutorial given in asp.net. My question might be too simple but I haven’t found the answer. For the quick response, I ask here.

Edit action method:

        // GET: /Movie/Edit/5

        public ActionResult Edit(int id = 0)
        {
            Movie movie = db.Movies.Find(id);
            if (movie == null)
            {
                return HttpNotFound();
            }
            return View(movie);
        }

        //
        // POST: /Movie/Edit/5

        [HttpPost]
        public ActionResult Edit(Movie movie)
        {
            if (ModelState.IsValid)
            {
                db.Entry(movie).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(movie);
        }

Delete action method:

        //
        // GET: /Movie/Delete/5

        public ActionResult Delete(int id = 0)
        {
            Movie movie = db.Movies.Find(id);
            if (movie == null)
            {
                return HttpNotFound();
            }
            return View(movie);
        }

        //
        // POST: /Movie/Delete/5

        [HttpPost, ActionName("Delete")]
        public ActionResult DeleteConfirmed(int id)
        {
            Movie movie = db.Movies.Find(id);
            db.Movies.Remove(movie);
            db.SaveChanges();
            return RedirectToAction("Index");
        }

Let us compare the HTTP POST for update and deletion. I am curious:

Why does the action method DeleteConfirmed use model id rather than model object as its parameter?

  • 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-11T04:46:08+00:00Added an answer on June 11, 2026 at 4:46 am

    Why does the action method DeleteConfirmed use model id rather than
    model object as its parameter?

    Because all you need in order to delete an entity is its id whereas in order to edit this entity you need the entire object. Also I guess that the view that is calling this Delete action is only sending the id of the entity to delete in the request so it would be meaningless to have the delete action take the whole entity as it will never be bound.

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

Sidebar

Related Questions

I'm a newbie about ASP.NET MVC 3, but I have a simple question. Is
I'm a total newbie at Entity Framework and ASP.Net MVC, having learned mostly from
I'm a newbie to ASP.NET MVC. I've been learning MVC 3 for the past
I'm a newbie to Asp.net,learning from the Apress's Begining Asp.net...book.While very curious to see
Newbie question. I’m writing an ASP.Net MVC app in VB.Net and have been using
C sharp newbie question...I have a simple asp.net form that has a textbox that
Hey all, this is a newbie ASP.NET MVC question. I have a view that
I am a newbie and just started learning the asp.net mvc, as I was
ASP.NET MVC newbie question: I've set up a MVC site, with a few controllers.
I just got out of ASP.NET Web Forms and is now an MVC newbie.

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.