// POST api/<controller> public void Post([FromBody] ProductDto product) { var context = new CallerContextDto() { DataSource = "ProductController" }; if (!context.Rights.HasFlag(Rights.Write)) { throw new AccessViolationException(); } _productService.SendToBus(context, product); }
// DELETE api/<controller>/5 public void Delete(int id) { var context = new CallerContextDto() { DataSource = "ProductController" }; if (!context.Rights.HasFlag(Rights.Delete)) { throw new AccessViolationException(); } _productService.GetProduct(context, id); }
// GET api/<controller>/5 public ProductDto Get(int id) { var context = new CallerContextDto() { DataSource = "ProductController" }; if (!context.Rights.HasFlag(Rights.Read)) { throw new AccessViolationException(); } return _productService.GetProduct(context, id); }