Я получаю эту ошибку:
Нет сопоставления между типом объекта Vue2Spa.Models.ApplicationModel
и собственным типом известного управляемого поставщика.
System.Data.SqlClient.MetaType.GetMetaTypeFromValue (Введите dataType, значение объекта, bool inferLen, bool streamAllowed.).SqlCommand.SetUpRPCParameters (_SqlRPC rpc, int startCount, параметры bool inSchema, SqlParameterCollection) System.Data.SqlClient..ExecuteNonQuery ()
Моя AddApplication
функция:
public int AddApplication(ApplicationModel item)
{
string SandBoxDB = configuration.GetConnectionString("SandBoxDB");
using (SqlConnection con = new SqlConnection(SandBoxDB))
{
SqlCommand sqlCmd = new SqlCommand("AddApplication", con);
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.Parameters.AddWithValue("@FirstName", item.FirstName);
sqlCmd.Parameters.AddWithValue("@LastName", item.LastName);
sqlCmd.Parameters.AddWithValue("@MiddleInitial", item.MiddleInitial);
sqlCmd.Parameters.AddWithValue("@Othername", item.OtherName);
sqlCmd.Parameters.AddWithValue("@SID", item.SID);
sqlCmd.Parameters.AddWithValue("@DateOfBirth", item.DateOfBirth);
sqlCmd.Parameters.AddWithValue("@PhoneNumber", item);
sqlCmd.Parameters.AddWithValue("@Email", item.Email);
sqlCmd.Parameters.AddWithValue("@Address", item.Address);
sqlCmd.Parameters.AddWithValue("@City", item.City);
sqlCmd.Parameters.AddWithValue("@State", item.State);
sqlCmd.Parameters.AddWithValue("@Zip", item.Zip);
sqlCmd.Parameters.AddWithValue("@PreferredCampus", item.Prefferedcampus);
sqlCmd.Parameters.AddWithValue("@Distric", item.Distric);
sqlCmd.Parameters.AddWithValue("@School", item.School);
sqlCmd.Parameters.AddWithValue("@Position", item.Position);
sqlCmd.Parameters.AddWithValue("@SubTest1", item.SubTest1);
sqlCmd.Parameters.AddWithValue("@TestAuthority1", item.TestAuthority1);
sqlCmd.Parameters.AddWithValue("@Score1", item.Score1);
sqlCmd.Parameters.AddWithValue("@DateTaken1", item.Datetaken1);
sqlCmd.Parameters.AddWithValue("@Score1", item.Score1);
sqlCmd.Parameters.AddWithValue("@Comment1", item.Comment1);
sqlCmd.Parameters.AddWithValue("@SubTest2", item.SubTest2);
sqlCmd.Parameters.AddWithValue("@TestAuthority2", item.TestAuthority2);
sqlCmd.Parameters.AddWithValue("@Score2", item.Score2);
sqlCmd.Parameters.AddWithValue("@DateTaken2", item.Datetaken2);
sqlCmd.Parameters.AddWithValue("@Score2", item.Score2);
sqlCmd.Parameters.AddWithValue("@Comment2", item.Comment2);
sqlCmd.Parameters.AddWithValue("@SubTest3", item.SubTest3);
sqlCmd.Parameters.AddWithValue("@TestAuthority3", item.TestAuthority3);
sqlCmd.Parameters.AddWithValue("@Score3", item.Score3);
sqlCmd.Parameters.AddWithValue("@DateTaken3", item.Datetaken3);
sqlCmd.Parameters.AddWithValue("@Score3", item.Score3);
sqlCmd.Parameters.AddWithValue("@Comment3", item.Comment3);
sqlCmd.Parameters.AddWithValue("@NinetyCredits", item.NinetyCredits);
sqlCmd.Parameters.AddWithValue("@AA", item.AA);
sqlCmd.Parameters.AddWithValue("@EarnedDegree", item.EarnedDegree);
sqlCmd.Parameters.AddWithValue("@OverallGpa", item.OverallGpa);
sqlCmd.Parameters.AddWithValue("@Education_School1", item.Education_School1);
sqlCmd.Parameters.AddWithValue("@Education_DegreeEarned1", item.Education_DegreeEarned1);
sqlCmd.Parameters.AddWithValue("@Education_GraduationDate1", item.Education_GraduationDate1);
sqlCmd.Parameters.AddWithValue("@Education_Major1", item.Education_Major1);
sqlCmd.Parameters.AddWithValue("@Education_School2", item.Education_School2);
sqlCmd.Parameters.AddWithValue("@Education_DegreeEarned2", item.Education_DegreeEarned2);
sqlCmd.Parameters.AddWithValue("@Education_GraduationDate2", item.Education_GraduationDate2);
sqlCmd.Parameters.AddWithValue("@Education_Major2", item.Education_Major2);
sqlCmd.Parameters.AddWithValue("@Education_School3", item.Education_School3);
sqlCmd.Parameters.AddWithValue("@Education_DegreeEarned3", item.Education_DegreeEarned3);
sqlCmd.Parameters.AddWithValue("@Education_GraduationDate3", item.Education_GraduationDate3);
sqlCmd.Parameters.AddWithValue("@ProgramOption_K8WithP3", item.ProgramOption_K8WithP3);
sqlCmd.Parameters.AddWithValue("@ProgramOption_K8WithK12", item.ProgramOption_K8WithK12);
sqlCmd.Parameters.AddWithValue("@ProgramOption_K8WithP3AndK12", item.ProgramOption_K8WithP3AndK12);
sqlCmd.Parameters.AddWithValue("@Gender", item.Gender);
sqlCmd.Parameters.AddWithValue("@Bilingual", item.Bilingual);
sqlCmd.Parameters.AddWithValue("@OtherLanguages", item.OtherLanguages);
sqlCmd.Parameters.AddWithValue("@NativeEnglish", item.NativeEnglish);
sqlCmd.Parameters.AddWithValue("@ParentsHighSchoolDiploma", item.ParentsHighSchoolDiploma);
sqlCmd.Parameters.AddWithValue("@Ethnicity", item.Ethnicity);
sqlCmd.Parameters.AddWithValue("@Race1", item.Race1);
sqlCmd.Parameters.AddWithValue("@Race2", item.Race2);
sqlCmd.Parameters.AddWithValue("@Race3", item.Race3);
sqlCmd.Parameters.AddWithValue("@Race4", item.Race4);
sqlCmd.Parameters.AddWithValue("@Race5", item.Race5);
sqlCmd.Parameters.AddWithValue("@Race6", item.Race6);
sqlCmd.Parameters.AddWithValue("@Signature", item.Signature);
con.Open();
sqlCmd.ExecuteNonQuery();
con.Close();
}
return 1;
}
Мой контроллер:
public class ApplicationController : BaseController
{
private ApplicationManager manager;
public ApplicationController(IConfiguration config) : base(config)
{
manager = new ApplicationManager(config);
}
[HttpGet]
[Route("api/[controller]")]
public IEnumerable<ApplicationModel> Index()
{
return manager.GetApplication();
}
[HttpPost]
[Route("api/[controller]")]
public int Create([FromBody] ApplicationModel application)
{
return manager.AddApplication(application);
}
Есть предложения, ребята?