public IActionResult Update([FromBody] Models.Feature model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var entity = _repository.GetById(model.Id); Mapper.Map <Models.Feature, Entities.Feature>(model, entity); _repository.Update(entity); return(Ok()); }
/// <inheritdoc /> public async Task <Feature> GetByName(string featureName, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(featureName)) { throw new ArgumentException("Invalid feature name"); } Models.Feature feature = await _dbContext.Features .SingleOrDefaultAsync(f => f.Name == featureName, cancellationToken) .ConfigureAwait(false); return(_iMapper.Map <Models.Feature, Feature>(feature)); }
public Feature(Models.Feature feature) { this.Title = feature.Name; this.Details = feature.Description; }