WebApi Sample - c# entity framework, northwind database, postman

 




        [HttpGet]
        [Route("Urunler/FiyataGoreTop10")]
        public async Task<System.Web.Http.IHttpActionResult> FiyatTop10()
        {
            var s1 = await (from u in db.Products
                            select new
                            {
                                u.ProductID
                            ,
                                u.ProductName
                            ,
                                u.UnitPrice
                            }).OrderByDescending(p=>p.UnitPrice).Take(10).ToListAsync();

            if (s1 == null)
            {
                return NotFound();
            }

            return Ok(s1);
        }





Yorumlar