示例#1
0
        public virtual async Task <IActionResult> Post(TEntitySaveResources saveResource)
        {
            try {
                var entity = _mapper.Map <TEntity>(saveResource);

                _repo.Create(entity);
                await _repo.SaveChangesAsync();


                var resoure = _mapper.Map <TEntityResource>(entity);

                return(CreatedAtAction(nameof(GetAll), resoure));
            } catch (Exception ex) {
                _logger.LogError(ex.Message);
                return(BadRequest());
            }
        }