public bool Add(AddStorageConfigurationDTO dto) { Collection.InsertOne(new ConfigurationDocument { Type = dto.Type, Value = dto.Value, Name = dto.Name, IsActive = dto.IsActive, CreationDate = DateTime.Now, LastModifyDate = DateTime.Now, ApplicationName = dto.ApplicationName }); return(true); }
public bool Add(AddStorageConfigurationDTO dto) { using (var context = new ConfigurationContext(GetConfigurationContextOptions())) { context.Configurations.Add(new Configuration { Type = dto.Type, Value = dto.Value, Name = dto.Name, IsActive = dto.IsActive, CreationDate = DateTime.Now, LastModifyDate = DateTime.Now, ApplicationName = dto.ApplicationName }); context.SaveChanges(); return(true); } }
public async Task <bool> AddAsync(AddStorageConfigurationDTO dto) { using (var dbConnection = Connection) { var query = "INSERT INTO \"Configuration\" (\"Name\", \"Type\", \"Value\",\"IsActive\",\"ApplicationName\",\"CreationDate\", \"LastModifyDate\")" + " VALUES(@Name, @Type, @Value,@IsActive, @ApplicationName,@CreationDate, @LastModifyDate )"; dbConnection.Open(); var res = await dbConnection.ExecuteAsync(query, new { Value = dto.Value, Name = dto.Name, ApplicationName = dto.ApplicationName, IsActive = dto.IsActive, Type = dto.Type, CreationDate = DateTime.Now, LastModifyDate = DateTime.Now }); return(res > 0); } }