2
Answers

Start Index of In SQL

declare @uname nvarchar(500)
set @uname='(123456) ANKIT SRIVASTAVA'
 
 
 
Desired OUTPUT
 
 

Answers (2)

2
Photo of pritaeas
NA 3.1k 862 7y
http://www.c-sharpcorner.com/UploadFile/088b17/getting-started-with-mvc4-and-webapi-in-Asp-Net/
1
Photo of Saravanan V
NA 983 37.5k 7y

I have explained below the What, Why, How and Where part of Web API.

What:
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.

Web API's controller action only return data that is serialized and sent to the client.

Why:
To expose your data to all of the modern devices from your rich internet applications. Typically, these applications use their HTTP connection to return data in the form of JSON or XML rather than HTML markup.

Content Negotiation based on Accept headers for request and response serialization.

How to use: 
Create a controller class which should inherit the "ApiController" base class from System.Web.Http. Your controller's methods can use any of those GET, PUT, POST, DELETE HTTP verbs to communicate with the clients.
 
Eg.
Controller:
public class ProductController : ApiController
{
        [HttpGet]
        public HttpResponseMessage ValidateProduct(int productId)
        { 
             // validation logic goes here..
        }

You can call your Web API method from client-side as below,
var apiUrl = "/api/Product/ValidateUpdate?productId=" + 10;
$.ajax({

url: apiUrl,
type: "GET",
contentType: "application/json;charset=utf-8",
success: function (data) {       // After successfull call, things to be done goes here..

},
error: function (data) {       // In case of exception, handle & display message...

         }
}); 

Where: 
You could use Web API in your ASP.NET Web Forms or MVC Applications or Single Page Applications.

Hosting:
It can be hosted with in the application or on IIS.
 
1
Photo of Fabricio Fogaça
NA 24 968 7y
An API can centralize all your information and bussiness logics, and this will be transparent for who or what required the information, the answer can be in JSON or XML.
Imagine you have a app and a website, both need to get the same information, you can make one query to each project(so you have two query to maintenance) or one API for both.
You create a new Project > ASP.NET Web Application > Empty and select Web API.
Creat a Controller, with actions GET(to get), POST(to insert ), PUT(to update) and Delete. It's like MVC but without Views.
Use Fiddler to see the results.
And makes a ASP.NET MVC to see it calling the WEB API.
Good tutorial to start:
https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api
-1
Photo of Thiruppathi R
NA 8.7k 371.4k 7y
This is my article,refer it once
http://www.c-sharpcorner.com/article/learn-web-api-using-wpf-webforms-and-xamarin/