public BasicResponse <ConfigInfo> AddConfig(ConfigAddRequest configrequest) { var _config = ObjectConverter.Copy <ConfigInfo, ConfigModel>(configrequest.ConfigInfo); var resultconfig = _Repository.AddConfig(_config); var configresponse = new BasicResponse <ConfigInfo>(); configresponse.Data = ObjectConverter.Copy <ConfigModel, ConfigInfo>(resultconfig); return(configresponse); }
public async Task <ActionResult <string> > AddConfig(SiteConfig config) { if (await repository.ConfigExistsAsync(config.Key)) { return(Conflict()); } repository.AddConfig(config); await repository.SaveAsync(); return(CreatedAtRoute(nameof(GetConfig), new { config.Key }, config.Value)); }