.convert rewritten a bit, isn't saved in the database anymore, but in redis.
This commit is contained in:
		| @@ -1,26 +0,0 @@ | ||||
| using NadekoBot.Core.Services.Database.Models; | ||||
| using System; | ||||
| using System.Linq; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
|  | ||||
| namespace NadekoBot.Core.Services.Database.Repositories.Impl | ||||
| { | ||||
|     public class UnitConverterRepository : Repository<ConvertUnit>, IUnitConverterRepository | ||||
|     { | ||||
|         public UnitConverterRepository(DbContext context) : base(context) | ||||
|         { | ||||
|         } | ||||
|  | ||||
|         public void AddOrUpdate(Func<ConvertUnit, bool> check, ConvertUnit toAdd, Func<ConvertUnit, ConvertUnit> toUpdate) | ||||
|         { | ||||
|            var existing = _set.FirstOrDefault(check); | ||||
|             if (existing != null) | ||||
|             { | ||||
|                 existing = toUpdate.Invoke(existing); | ||||
|             } | ||||
|             else _set.Add(toAdd); | ||||
|         } | ||||
|  | ||||
|         public bool Empty() => !_set.Any(); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user