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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:48:24+00:00 2026-06-15T09:48:24+00:00

This is the first table created on my own that I am trying to

  • 0

This is the first table created on my own that I am trying to insert data.

Question: in my controller, I am not sure how to link the model with the actual database table to perform the INSERT.

Also in the line uc.userId = userId; I am getting the following error:

Invalid initializer member declarato

I created a model for this table:

public class RegisterModel
{
    public bool isCertified { get; set; }
    public int certType { get; set; }
    public string identifier { get; set; }
}

View:

<tr>
   <td style="font-size:10px;">Habilitar Login com Cert. Digital:</td>
   <td>@Html.CheckBoxFor(m => m.isCertified)</td>
</tr>                                      
<div id="certDigitalBlock">
<tr>
    <td class="smallField">Tipo do Certificado:</td>
    <td>@Html.DropDownListFor(m => m.certType, new SelectList(ViewBag.certType, "id","type"))</td>
</tr>
<tr>
    <td>Identificação:</td>
    <td>@Html.TextBoxFor(m => m.identifier, new { @class = "validate[required]" })      @Html.ValidationMessage("awnserVal", "*")</td>
</tr> 
</table>

Controller

using (tgpwebgedEntities context = new tgpwebgedEntities())
{
   var userID = from u in context.aspnet_Users where u.UserName == model.UserName select u.UserId;

   if (checkIsCertified == true)
   {
      UsersCertified uc = new UsersCertified {
                            uc.userId = userId;
                            uc.certTypeId = model.certType;
                            uc.keyNumber = model.identifier;
                        }

      context.SaveChanges()
   }
}

Thanks

  • 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-15T09:48:25+00:00Added an answer on June 15, 2026 at 9:48 am
    UsersCertified uc = new UsersCertified {
                                uc.userId = userId;
                                uc.certTypeId = model.certType;
                                uc.keyNumber = model.identifier;
                            }
    

    Shouldn’t be written under brackets? if you are using a constructor.

    UsersCertified uc = new UsersCertified (
                                uc.userId = userId;
                                uc.certTypeId = model.certType;
                                uc.keyNumber = model.identifier;
                            )
    

    Add this code:

    context.UsersCertified .InsertOnSubmit(uc);
                    context.SubmitChanges();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my first time making a hash table. I'm trying to associate strings
I am using a code-first methodology. I have created my own user model and
First Table is the View and Second is the result I want This below
This is what I got: http://jsfiddle.net/hashie5/vk6rZ/ (don't mind the layout) The first table is
I'm trying to write a table trigger which queries another table that is outside
First of all, sorry for the too long question. I know that there are
I created a dynamic table in ASP/VBScript that populates a table from a recordset.
I have this homework question: Assume a Database table has 0 records at time
UPDATE: See my answer to this question first. This appears to be a bug.
Ok, my first question was modified so many times that I chose to delete

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.