Untitled

 avatar
unknown
plain_text
2 years ago
957 B
3
Indexable
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyPro2.Models;


namespace MyPro2.Controllers.api
{
    [Route("api/[controller]")]
    public class ClothController : ControllerBase
    {
        List<Cloth> cloths = new List<Cloth>();
        //GET :api/values
        [HttpGet]
        public IActionResult Get()
        {
            Cloth c1 = new Cloth() { ProductName = "A", Price = 345, ProductDescription = "xyz" };
            Cloth c2 = new Cloth() { ProductName = "B", Price = 404, ProductDescription = "rmb" };
            cloths.Add(c1);
            cloths.Add(c2);

            return Ok(cloths);
        }

        //GET :api/values/5
        [HttpGet("{id}")]
        public string Get(int id)
        {
            return "value";
        }
        
        //POST :api/values
        [HttpGet("{id}")]
        public void Post([FromBody]string value)
        {
        }
    }
}