forked from kshyju/BrowserDetector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from lars-lange/mergeconflicts
Mergeconflicts
- Loading branch information
Showing
21 changed files
with
271 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
sample/BrowserDetector.WebApi/Controllers/HomeController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Shyjus.BrowserDetection; | ||
|
||
namespace BrowserDetector.WebApi.Controllers | ||
{ | ||
[ApiController] | ||
public class HomeController : ControllerBase | ||
{ | ||
private readonly ILogger<HomeController> _logger; | ||
private readonly IBrowserDetector _browserDetector; | ||
public HomeController(IBrowserDetector browserDetector, ILogger<HomeController> logger) | ||
{ | ||
_logger = logger ?? throw new ArgumentNullException(nameof(logger)); | ||
_browserDetector = browserDetector ?? throw new ArgumentNullException(nameof(browserDetector)); | ||
} | ||
|
||
[HttpGet] | ||
[Route("")] | ||
public string Get() | ||
{ | ||
this._logger.LogInformation("Inside GET action method"); | ||
|
||
var browser = _browserDetector.Browser; | ||
|
||
_logger.LogInformation($"Browser:{browser?.Name},OS: {browser?.OS}"); | ||
|
||
return $".NET APP. Browser:{browser?.Name}, Version: {browser?.Version},Device type: {browser?.DeviceType}, OS: {browser?.OS}"; | ||
} | ||
} | ||
} |
Oops, something went wrong.