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))); }
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)); }