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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:30:16+00:00 2026-06-12T06:30:16+00:00

I have a controller, Hardware which has a Create action. The model looks like:

  • 0

I have a controller, “Hardware” which has a “Create” action.

The model looks like:

namespace Inventory.Models
{
public class HardwareModel
    {
    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public int ID { get; set; }

    public string UPDATED { get; set; }

    [Required]
    [DataType(DataType.Text)]
    [Display(Name = "Brand")]
    public string BRAND { get; set; }

    [Required]
    [DataType(DataType.Text)]
    [Display(Name = "Model")]
    public string MODEL { get; set; }
    }
}

This works just fine in conjunction with the /Hardware/Create/ controller which was generated (create action uses Razor template), however, when a new item is created, I would like to also update another table which keeps track of which item was updated (ID from HardwareModel), and when it was updated. I am able to get both of these fields I need – but my question is, how do I extend this model to create a new record in 2 seperate tables? (using MVC4)

  • 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-12T06:30:18+00:00Added an answer on June 12, 2026 at 6:30 am

    That sounds like a candidate method for a service layer.

    If your business logic dictates that creating a HardwareModel entity also requires creating two other entities, enforce that rule in a service method and unit test that the create methods for those two entities are called.

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

Sidebar

Related Questions

Have Controller: public class MyController : Controller { [HttpGet] public ActionResult MyAction(int iMode, string
I have controller users . In this controller I have action account which is
I have controller with action new , and I want it to create ActiveRecord::Base
I have Controller: [MySite]\Controllers\DistributionTools\TrackingChannelsController.cs [HttpPost] public void InitTcFirstPageView() { var model = new TcFirstPageModel
I have @Controller @RequestMapping(value=core/*) public class CoreController { public static String exceptionOccurredView = /core/exceptionOccurred;
I have controller action which returns JsonResult and is consumed by jquery ajax get
I have controller vegetable . It has standart new and create methods. I want
I have controller methods that look like this: class TestController < ApplicationController def testAction
I have controller and model. i am modifying a variable value in a model,
Hi guys i have controller which returns a partial view, the controller is called

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.