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

  • Home
  • SEARCH
  • 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 6854767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:40:29+00:00 2026-05-27T01:40:29+00:00

I have a plans list, or whatever it is, and I don’t want any

  • 0

I have a plans list, or whatever it is, and I don’t want any of them to be deleted.
That’s why when someone choose the “edit” option – I actually want to add a new plan with the same references, but just a new ID. Then, I don’t care at all what changes will be made in it in the edit view (which is in fact the create view).

I use the same view whether it create new or edit, but the only difference is that if the action get a plan – I understand it is not create new but edit and then I want to display in the create view all the “edited” plan parameters, and if there isn’t any plan (if the action does not get any plan) – I understand it’s a totaly new plan (someone choose the “Create new” option), and then I want to display the same view – with blank fields.

Here is my code:

public ActionResult CreatePlan(Plan? plan)
        {
            if (plan == null)
            {
                return View();
            }
            else 
            {
                Plan oldPlan = db.PlanSet.Single(p => p.Id == plan.Value.Id);
                return View(oldPlan);
            }
        }

Currently, as you can see, if the action does get an object – it lets me edit the old plan.

How can I duplicate it so any change that will be made in the view – will be saved with another plan ID???
Hope I made myself clear and am happy to get some help !

  • 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-05-27T01:40:30+00:00Added an answer on May 27, 2026 at 1:40 am

    For my question I didn’t need to use something complicated at all.

    All I needed to to is to create two get actions, one with blank fields and another with fields full with the edited object.

    the two views send their parameters to the same post action, that gets the sent object and add it to the database. when I write: db.PlanSet.AddObject(plan); -it automatically adds the same object with new Id, without removing or changing the original object.

    Good Luck!!

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

Sidebar

Related Questions

I have a Latex Table that for weekly lesson plans, I want to pull
mvc - c# - aspx => i have a DDL(drop down list), that shows
I have a query that retrieves a list of received part shipments from plants.
I have plans to create an app which gives me the list of words
I have a list and I want to copy three other lists into it.
I have one Sharepoint list that contains training courses and duration (in hours). I
I have an application with three modules: default , disciplines and plans . In
I currently have a Ruby on Rails system, and there are plans to port
We have a daily maintenance plan in SQL Server 2005 that performs a full
I have a button that plays an audio file on its click listener. If

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.