Click here to Skip to main content
14,837,944 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionMSChart text annotation asp.net 4.5 Pin
BobbyStrain5-Jul-16 6:01
MemberBobbyStrain5-Jul-16 6:01 
AnswerRe: MSChart text annotation asp.net 4.5 Pin
koolprasadd5-Jul-16 18:20
professionalkoolprasadd5-Jul-16 18:20 
Questionentity framwork one-to-many relation Pin
a1_shay5-Jul-16 4:37
Membera1_shay5-Jul-16 4:37 
AnswerRe: entity framwork one-to-many relation Pin
John C Rayan6-Jul-16 2:28
professionalJohn C Rayan6-Jul-16 2:28 
AnswerRe: entity framwork one-to-many relation Pin
Nathan Minier13-Jul-16 1:48
professionalNathan Minier13-Jul-16 1:48 
QuestionAutomating a website using Asp.net Pin
srikrishnathanthri3-Jul-16 23:56
Membersrikrishnathanthri3-Jul-16 23:56 
AnswerRe: Automating a website using Asp.net Pin
Member 1039877314-Jul-16 21:40
MemberMember 1039877314-Jul-16 21:40 
QuestionWeb api insert failed but code seems fine Pin
DotNetFellow1-Jul-16 19:14
MemberDotNetFellow1-Jul-16 19:14 
hi

I do not know where is going wrong but i seems not able to insert data using web api. Any help greatly appreciated and thanks a lot

The data
{"ID":1,"EmailAddress":"demo@demo.com"}

and the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using Dapper;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;

namespace cirqer.Controllers.api
{

public class EmailListList
{

public int ID { get; set; }

public string EmailAddress { get; set; }

}

public class emaillistController : ApiController
{
static string connectionstring = ConfigurationManager.ConnectionStrings["CRConnectionString"].ConnectionString;

[HttpGet]
public Int16 EmailList_SelectCount()
{
try
{
using (var conn = new SqlConnection(connectionstring))
{
Int16 x = conn.ExecuteScalar<short>("EmailList_SelectCount", commandType: CommandType.StoredProcedure);
return x;
}
}
catch
{
return 0;
}


}

[HttpPost]
public void EmailList_Insert(EmailListList email)
{
try
{
// dynamic data = email;
using (var conn = new SqlConnection(connectionstring))
{
conn.Open();
conn.Execute("EmailList_Insert", email, commandType: CommandType.StoredProcedure);
conn.Close();
}
}
catch
{

}

}

}
}
QuestionRadiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
Codeaddict742330-Jun-16 9:25
MemberCodeaddict742330-Jun-16 9:25 
QuestionRe: Radiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
ZurdoDev30-Jun-16 10:28
professionalZurdoDev30-Jun-16 10:28 
AnswerRe: Radiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
Codeaddict742330-Jun-16 10:35
MemberCodeaddict742330-Jun-16 10:35 
GeneralRe: Radiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
Richard Deeming30-Jun-16 10:52
mveRichard Deeming30-Jun-16 10:52 
GeneralRe: Radiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
Codeaddict742330-Jun-16 11:16
MemberCodeaddict742330-Jun-16 11:16 
GeneralRe: Radiobuttonlist choice disables requiredfieldvalidator in textboxes and other radiobuttonlist Pin
Richard MacCutchan30-Jun-16 22:26
mveRichard MacCutchan30-Jun-16 22:26 
QuestionAngularjs is not refreshing data on the CSHTML page Pin
indian14330-Jun-16 2:39
Memberindian14330-Jun-16 2:39 
AnswerRe: Angularjs is not refreshing data on the CSHTML page Pin
John C Rayan30-Jun-16 21:24
professionalJohn C Rayan30-Jun-16 21:24 
GeneralRe: Angularjs is not refreshing data on the CSHTML page Pin
indian1431-Jul-16 0:40
Memberindian1431-Jul-16 0:40 
GeneralRe: Angularjs is not refreshing data on the CSHTML page Pin
John C Rayan1-Jul-16 1:18
professionalJohn C Rayan1-Jul-16 1:18 
GeneralRe: Angularjs is not refreshing data on the CSHTML page Pin
indian1431-Jul-16 4:15
Memberindian1431-Jul-16 4:15 
GeneralRe: Angularjs is not refreshing data on the CSHTML page Pin
John C Rayan4-Jul-16 0:22
professionalJohn C Rayan4-Jul-16 0:22 
QuestionWhen to use ASP.NET Webforms, MVC, Web API Pin
larsp77729-Jun-16 0:04
Memberlarsp77729-Jun-16 0:04 
AnswerRe: When to use ASP.NET Webforms, MVC, Web API Pin
F-ES Sitecore30-Jun-16 1:03
mveF-ES Sitecore30-Jun-16 1:03 
GeneralRe: When to use ASP.NET Webforms, MVC, Web API Pin
larsp77730-Jun-16 1:37
Memberlarsp77730-Jun-16 1:37 
GeneralRe: When to use ASP.NET Webforms, MVC, Web API Pin
F-ES Sitecore30-Jun-16 2:12
mveF-ES Sitecore30-Jun-16 2:12 
GeneralRe: When to use ASP.NET Webforms, MVC, Web API Pin
larsp77730-Jun-16 2:22
Memberlarsp77730-Jun-16 2:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.