Example #1
0
        public virtual async Task <ActionResult> Post([FromBody] T value)
        {
            // For legibility
            var req = HttpContext.Request;
            //var locationUri = $"{req.Url.Scheme}://{req.Host}/{req.Path}/{Crud.EntityId(value)}";
            await Crud.AddAndSaveAsync(value);

            return(new EmptyResult());
        }
Example #2
0
 public virtual async Task <IActionResult> OnPost(T model)
 {
     if (ModelState.IsValid)
     {
         // For legibility
         var req         = HttpContext.Request;
         var locationUri = $"{req.Protocol}://{req.Host}/{req.Path}/{Crud.EntityId(model)}";
         return(Created(locationUri, await Crud.AddAndSaveAsync(model)));
     }
     return(this.ODataModelStateError());
 }