예제 #1
0
    // 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);
    }
예제 #2
0
    // 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);
    }
예제 #3
0
    // 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);
    }