Exemplo n.º 1
0
        public async Task <IActionResult> GetListOfLaptopAsync([FromRoute(Name = "id")] int id)
        {
            DC.Laptop result = await _laptopProvider.GetListOfLaptopByIdAsync(id);

            if (result == null)
            {
                return(this.NotFound(result));
            }
            return(this.Ok(await Task.FromResult(result)));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> AddLaptopAsync([FromBody] DC.Laptop laptop)
        {
            DC.LaptopResponse result = null;
            result = await _laptopProvider.AddLaptopAsync(laptop);

            if (result == null)
            {
                return(this.StatusCode(StatusCodes.Status400BadRequest, "Unable to create site."));
            }
            return(Ok(result));
        }