Created
January 21, 2018 22:57
-
-
Save aramkoukia/1d450103fde02b7d121648715fed12a7 to your computer and use it in GitHub Desktop.
Orders Read Model Controller
This file contains hidden or 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
| using System; | |
| using System.Web.Http; | |
| using MicroServices.Common.Exceptions; | |
| namespace Sales.ReadModels.Service.Controllers | |
| { | |
| public class OrdersController : ApiController | |
| { | |
| [HttpGet] | |
| public IHttpActionResult Get(Guid id) | |
| { | |
| var view = ServiceLocator.BrandView; | |
| try | |
| { | |
| var dto = view.GetById(id); | |
| return Ok(dto); | |
| } | |
| catch (ReadModelNotFoundException) | |
| { | |
| return NotFound(); | |
| } | |
| } | |
| [HttpGet] | |
| public IHttpActionResult Get() | |
| { | |
| var view = ServiceLocator.BrandView; | |
| var result = view.GetAll(); | |
| return Ok(result); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment