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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:34:42+00:00 2026-05-14T16:34:42+00:00

My controller’s call to repository insert method all the values are passed but it

  • 0

My controller’s call to repository insert method all the values are passed but it doesn’t get inserted in my table..

My controller method,

[AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Create([Bind(Exclude = "Id")]FormCollection collection)
        {
            try
            {
                MaterialsObj materialsObj = new MaterialsObj();
                materialsObj.Mat_Name = collection["Mat_Name"];
                materialsObj.Mes_Id = Convert.ToInt64(collection["MeasurementType"]);
                materialsObj.Mes_Name = collection["Mat_Type"];
                materialsObj.CreatedDate = System.DateTime.Now;
                materialsObj.CreatedBy = Convert.ToInt64(1);
                materialsObj.IsDeleted = Convert.ToInt64(1);
                consRepository.createMaterials(materialsObj);

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

and my repository,

public MaterialsObj createMaterials(MaterialsObj materialsObj)
{
    Material mat = new Material();
    mat.Mat_Name = materialsObj.Mat_Name;
    mat.Mat_Type = materialsObj.Mes_Name;
    mat.MeasurementTypeId = materialsObj.Mes_Id;
    mat.Created_Date = materialsObj.CreatedDate;
    mat.Created_By = materialsObj.CreatedBy;
    mat.Is_Deleted = materialsObj.IsDeleted;
    db.Materials.InsertOnSubmit(mat);
    return materialsObj;
}

What am i missing here any suggestion….

  • 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-14T16:34:43+00:00Added an answer on May 14, 2026 at 4:34 pm

    As far as I can see, you’re missing a db.SubmitChanges(); to save to the database.

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

Sidebar

Related Questions

My controller calls a repository class method on insert, [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create([Bind(Exclude =
setup Controller -> Action Index results = Model.all (SQL Call) View Loop through and
Controller Call user = User.authenticate(params[:session][:email], params[:session][:password]) Authenticate Method in user.rb class << self def
controller $data[controller] = $table; $data[rows] = $this->base_model->get();//get table attributes and names $write_add = $this->load->view(generate/add,$data,TRUE);//load
controller code that doesn't work: @mailings = Mailing.find(:all, :conditions => [created_at.month = ?, m])
Controller to get an image: public class PicturesSmallController : Controller { public ActionResult Details(int
My controller get datas from database model, and sends them to view. In view
Inside Controller I need to get a rendered string and do some actions with
Controller: class GalleriesController < ApplicationController def index @galleries = Gallery.all end end View: <%
Controller ClientDocument. def upload_document ClientDocument.upload_client_document(params) end Model ClientDocument. Class method.. def self.upload_client_document(params) self.new :uploaded_data

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.