public virtual async Task <IActionResult> Post([FromBody] T entity)
        {
            await this.Uow.RegisterNewAsync <T>(entity);

            await Uow.CommitAsync();

            return(Created($"{HttpContext.Request.Path.ToUriComponent()}/{ApplicationExtensions.GetKeyValue(entity)}", ApplicationExtensions.GetKeyValue(entity)));
        }
Beispiel #2
0
        public virtual async Task <IActionResult> Post([FromBody] T entity)
        {
            var validations = this.Domain.AddValidation(entity);

            if (validations.Count() == 0)
            {
                await this.Domain.AddAsync(entity);

                return(Created($"{HttpContext.Request.Path.ToUriComponent()}/{ApplicationExtensions.GetKeyValue(entity)}", ApplicationExtensions.GetKeyValue(entity)));
            }
            return(BadRequest(validations));
        }