0% found this document useful (0 votes)
7 views

P11

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

P11

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Date:

Program for creating and using API


Ex: 11

Enrollment No: 92210103022 Name: Namrata Solanki Class & Batch: 6TC6-C

DefaultController.cs:

using System.Collections.Generic;
using System.Web.Http;
public class DefaultController : ApiController
{
static List<string> languages = new List<string>()
{"C#","ASP.NET","MVC"
};
public IEnumerable<string> Get()
{
return languages;
}
public string Get(int id)
{ return languages[id]; }
public void Post([FromBody] string value)
{
languages.Add(value);
}
public void Put(int id, [FromBody] string value)
{
languages[id] = value;
}
public void Delete(int id)
{
languages.RemoveAt(id);
}
}

.NET Technologies Lab (01CE1602)


Output:

.NET Technologies Lab (01CE1602) 43

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy