示例#1
0
        /// <summary>
        /// 初始化基本变量
        /// </summary>
        /// <returns></returns>
        static bool Init()
        {
            var serverUser = GeneralProcess.GetUserByLoginName(AppConfig.ServerAccount);

            if (serverUser == null)
            {
                Log("通信管理员账号信息错误,请检查配置!");
                return(false);
            }

            ProcessInvoke.SetupGlobalRepositoryContext(serverUser, serverUser.Domain);

            using (var context = new RepositoryDbContext())
            {
                foreach (var data in AppConfig.CommandDatas)
                {
                    ProduceDatas.Add(context.Set <CommandData>().First(obj => obj.DataName == data));
                }

                foreach (var data in AppConfig.RunningTimeDatas)
                {
                    RunningTimeDatas.Add(context.Set <CommandData>().First(obj => obj.DataName == data));
                }

                _hotelGuids = context.Set <HotelRestaurant>().ToList();
            }

            _produceEndDayHour = DateTime.Now.AddHours(-1).GetCurrentHour();
            _produceEndDay     = DateTime.Now.AddDays(-1).GetToday();

            Log($"【{DateTime.Now:yyyy-MM-dd HH:mm:ss}】系统初始化完成。");
            return(true);
        }
示例#2
0
        /// <summary>
        /// 读取权限信息
        /// </summary>
        public static void LoadBaseInfomations()
        {
            RefreashUserPermissionsCache();

            RefreashRolePermissionsCache();

            RefreashModules();

            RefreashPermissions();

            using (var context = new RepositoryDbContext())
            {
                var commandDatas = context.Set <CommandData>();
                CommandDataId.CleanerCurrent =
                    commandDatas.First(obj => obj.DataName == ProtocolDataName.CleanerCurrent).Id;
                CommandDataId.CleanerSwitch =
                    commandDatas.First(obj => obj.DataName == ProtocolDataName.CleanerSwitch).Id;
                CommandDataId.FanCurrent =
                    commandDatas.First(obj => obj.DataName == ProtocolDataName.FanCurrent).Id;
                CommandDataId.FanSwitch =
                    commandDatas.First(obj => obj.DataName == ProtocolDataName.FanSwitch).Id;
                CommandDataId.LampblackInCon =
                    commandDatas.First(obj => obj.DataName == ProtocolDataName.LampblackInCon).Id;
                CommandDataId.LampblackOutCon =
                    commandDatas.First(obj => obj.DataName == ProtocolDataName.LampblackOutCon).Id;
            }
        }
示例#3
0
        public override async Task <DAL.App.DTO.BillLine> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var billLine = await RepositoryDbSet.FindAsync(id);

            if (billLine != null)
            {
                await RepositoryDbContext.Entry(billLine)
                .Reference(c => c.Bill)
                .LoadAsync();

                await RepositoryDbContext.Entry(billLine.Bill)
                .Reference(c => c.Comment)
                .LoadAsync();

                await RepositoryDbContext.Entry(billLine.Bill.Comment)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();

                await RepositoryDbContext.Entry(billLine)
                .Reference(c => c.Product)
                .LoadAsync();

                await RepositoryDbContext.Entry(billLine.Product)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();
            }

            return(BillLineMapper.MapFromDomain(billLine));
        }
示例#4
0
        public async Task <NthChildInFamilyDTO> GetNthChildInFamily(int id)
        {
            // get mom
            var mom = await RepositoryDbContext.Set <Domain.PersonInRelationship>()
                      .Where(w => w.Person1Id == id && w.Relationship.Relation == Relation.Ema)
                      .Select(e => e.Person).FirstOrDefaultAsync();

            // get dad
            var dad = await RepositoryDbContext.Set <Domain.PersonInRelationship>()
                      .Where(w => w.Person1Id == id && w.Relationship.Relation == Relation.Isa)
                      .Select(e => e.Person).FirstOrDefaultAsync();

            // get children
            var childrenCount = await RepositoryDbContext.Set <Domain.PersonInRelationship>()
                                .Include(i => i.Person)
                                .Include(i => i.Person1)
                                .Where(w =>
                                       (dad != null && w.PersonId == dad.Id) && w.Relationship.Relation == Relation.Isa ||
                                       (mom != null && w.PersonId == mom.Id) && w.Relationship.Relation == Relation.Ema)
                                .Select(e => e.Person1).Distinct().CountAsync();

            return(_personMapper.MapToNthChild(
                       childrenCount,
                       await RepositoryDbSet.Where(w => w.Id == id).FirstOrDefaultAsync()));
        }
示例#5
0
 public AnalysisCreatorController(RepositoryDbContext context, IGitCloneServices gitCloneServices, ICounterChange counterChange, IGitInitService gitInitService)
 {
     this.gitCloneServices = gitCloneServices;
     this.gitInitService   = gitInitService;
     this.counterChange    = counterChange;
     _context = context;
 }
示例#6
0
        public override async Task <DTO.Dog> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var dog = await RepositoryDbSet.FindAsync(id);

            if (dog != null)
            {
                await RepositoryDbContext.Entry(dog)
                .Reference(c => c.Sex)
                .LoadAsync();

                await RepositoryDbContext.Entry(dog.Sex)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();

                await RepositoryDbContext.Entry(dog)
                .Reference(c => c.Breed)
                .LoadAsync();

                await RepositoryDbContext.Entry(dog.Breed)
                .Reference(c => c.BreedName)
                .LoadAsync();

                await RepositoryDbContext.Entry(dog.Breed.BreedName)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();
            }

            return(DogMapper.MapFromDomain(dog));
        }
示例#7
0
        public async Task Create_User_Feedback_Success(int rating, string sessionId, string comment)
        {
            //Act
            using (var context = new RepositoryDbContext(this.repositoryDbContextMock.options))
            {
                this.repositoryDbContextMock.usersMock = new List <User>();
                var userMock = new User(Guid.NewGuid(), "User1", "UserName", "*****@*****.**");
                this.repositoryDbContextMock.usersMock.Add(userMock);

                this.repositoryDbContextMock.userFeedbacksMock = new List <UserFeedback>();

                var actionResultMessage = await this.userFeedbackRepository.AddAsync(
                    new UserFeedback(
                        Guid.NewGuid(),
                        new User(userMock.Id, userMock.NickName, userMock.Name, userMock.Email),
                        sessionId,
                        rating,
                        comment)
                    );

                //Asserts
                actionResultMessage.Should().NotBeNull();
                actionResultMessage.StatusCode.Should().Be(HttpStatusCode.OK);
                actionResultMessage.Message.Should().Contain("Feedback");
            }
        }
        public override async Task <DAL.App.DTO.ClientGroup> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var clientGroup = await RepositoryDbSet.FindAsync(id);

            if (clientGroup != null)
            {
                await RepositoryDbContext.Entry(clientGroup)
                .Collection(c => c.Clients)
                .LoadAsync();

                await RepositoryDbContext.Entry(clientGroup)
                .Reference(c => c.Name)
                .LoadAsync();

                await RepositoryDbContext.Entry(clientGroup.Name)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();

                await RepositoryDbContext.Entry(clientGroup)
                .Reference(c => c.Description)
                .LoadAsync();

                await RepositoryDbContext.Entry(clientGroup.Description)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();
            }

            return(ClientGroupMapper.MapFromDomain(clientGroup));
        }
            public async Task Returns_All_Items()
            {
                var model1 = new ServiceApiDescriptionBuilder().WithServiceId("AllItem1").Build();
                var model2 = new ServiceApiDescriptionBuilder().WithServiceId("AllItem2").Build();

                using (var context = new RepositoryDbContext(DbContextOptions, StoreOptions))
                {
                    context.Apis.RemoveRange(context.Apis.ToArray());
                    context.Apis.Add(model1.ToEntity());
                    context.Apis.Add(model2.ToEntity());
                    context.SaveChanges();
                }

                using (var context = new RepositoryDbContext(DbContextOptions, StoreOptions))
                {
                    var store    = new ApiStore(context, new Mock <ILogger <ApiStore> >().Object);
                    var services = (await store.GetAllAsync()).OrderBy(s => s.ServiceId).ToList();

                    services.Should().HaveCount(2);
                    services[0].ServiceId.Should().Be(model1.ServiceId);
                    services[0].ApiDocument.Info.Title.Should().Be(model1.ApiDocument.Info.Title);

                    services[1].ServiceId.Should().Be(model2.ServiceId);
                    services[1].ApiDocument.Info.Title.Should().Be(model2.ApiDocument.Info.Title);
                }
            }
            public async Task Updates_ApiDocument_On_Existing_Item()
            {
                var model = new ServiceApiDescriptionBuilder().WithServiceId("Updates_DisplayName_On_Existing_Item").Build();

                using (var context = new RepositoryDbContext(DbContextOptions, StoreOptions))
                {
                    context.Apis.Add(model.ToEntity());
                    context.SaveChanges();
                }

                model.ApiDocument.Info.Title = "New title";

                using (var context = new RepositoryDbContext(DbContextOptions, StoreOptions))
                {
                    var store = new ApiStore(context, new Mock <ILogger <ApiStore> >().Object);
                    await store.StoreAsync(model);
                }

                using (var context = new RepositoryDbContext(DbContextOptions, StoreOptions))
                {
                    var item = context.Apis.SingleOrDefault(s => s.ServiceId == model.ServiceId);
                    item.Should().NotBeNull();

                    var document = OpenApiDocumentHelper.ReadFromJson(item.ApiDocument);

                    document.Info.Title.Should().Be(model.ApiDocument.Info.Title);
                }
            }
示例#11
0
        public override async Task <DAL.App.DTO.AppUserInPosition> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var workerInPosition = await RepositoryDbSet.FindAsync(id);

            if (workerInPosition != null)
            {
                await RepositoryDbContext.Entry(workerInPosition)
                .Reference(c => c.AppUserPosition)
                .LoadAsync();

                await RepositoryDbContext.Entry(workerInPosition.AppUserPosition)
                .Reference(c => c.AppUserPositionValue)
                .LoadAsync();

                await RepositoryDbContext.Entry(workerInPosition.AppUserPosition.AppUserPositionValue)
                .Collection(c => c.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();

                await RepositoryDbContext.Entry(workerInPosition)
                .Reference(c => c.AppUser)
                .LoadAsync();
            }

            return(AppUserInPositionMapper.MapFromDomain(workerInPosition));
        }
示例#12
0
        public SignInResult PasswordSignIn(string loginName, string password, bool rememberMe,
                                           bool shouldLockout = false)
        {
            var result = new SignInResult();

            using (var context = new RepositoryDbContext())
            {
                var md5Password = Globals.GetMd5(password);
                var user        = context.Set <WdUser>()
                                  .FirstOrDefault(obj => obj.LoginName == loginName && obj.Password == md5Password && obj.IsEnabled);

                if (user == null)
                {
                    result.Status       = SignInStatus.Failure;
                    result.ErrorElement = "Password";
                    result.ErrorMessage = "无效的用户名或登陆密码";
                    return(result);
                }

                FormsAuthentication.SetAuthCookie(loginName, false);

                user.LastLoginDateTime = DateTime.Now;
                context.SaveChanges();
            }
            result.Status = SignInStatus.Success;

            return(result);
        }
示例#13
0
        public async Task <PersonWithMostPredecessorsDTO> GetPersonWithMostPredecessors()
        {
            var result = new Dictionary <int, Tuple <int, Person> >();
            var index  = 0;

            var personsWithParents = await RepositoryDbContext.Set <Domain.PersonInRelationship>()
                                     .Include(i => i.Relationship)
                                     .Include(i => i.Person1)
                                     .Where(w => (w.Relationship.Relation == Relation.Ema || w.Relationship.Relation == Relation.Isa))
                                     .Select(e => e.Person1)
                                     .Where(w => w.RelatedFrom.Any(ww => ww.Relationship.Relation == Relation.Poeg ||
                                                                   ww.Relationship.Relation == Relation.Tütar)).ToListAsync();

            foreach (var person in personsWithParents)
            {
                RelatedPersonsIds[person.Id] = new List <Person>();
                await GetParents(person, person.Id);

                result.Add(index, new Tuple <int, Person>(RelationsCounter, person));

                index           += 1;
                RelationsCounter = new int();
            }

            return(_personMapper.MapToPredecessorDtoFormat(result, RelatedPersonsIds));
        }
示例#14
0
 /// <summary>
 /// 获取系统配置信息
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="exp"></param>
 /// <returns></returns>
 public static object GetConfig <T>(Expression <Func <T, bool> > exp) where T : class
 {
     using (var context = new RepositoryDbContext())
     {
         return(context.Set <T>().Where(exp).ToList());
     }
 }
示例#15
0
        public override async Task <DAL.App.DTO.Payment> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var payment = await RepositoryDbSet.FindAsync(id);

            if (payment != null)
            {
                await RepositoryDbContext.Entry(payment)
                .Reference(c => c.PaymentMethod)
                .LoadAsync();

                await RepositoryDbContext.Entry(payment.PaymentMethod)
                .Reference(c => c.PaymentMethodValue)
                .LoadAsync();

                await RepositoryDbContext.Entry(payment.PaymentMethod.PaymentMethodValue)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();
            }

            return(PaymentMapper.MapFromDomain(payment));
        }
示例#16
0
        public override async Task <TaskerTask> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var taskerTask = await RepositoryDbSet.FindAsync(id);

            if (taskerTask != null)
            {
                await RepositoryDbContext.Entry(taskerTask)
                .Reference(c => c.TaskName)
                .LoadAsync();

                await RepositoryDbContext.Entry(taskerTask)
                .Reference(c => c.Description)
                .LoadAsync();

                await RepositoryDbContext.Entry(taskerTask.TaskName)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();

                await RepositoryDbContext.Entry(taskerTask.Description)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();
            }

            return(TaskerTaskMapper.MapFromDomain(taskerTask));
        }
示例#17
0
 public UnitOfWork(RepositoryDbContext context)
 {
     _context           = context;
     AccountsRepository = new AccountRepository(context);
     UsersRepository    = new UserRepository(context);
     ListOfFields       = new ListOfFields();
 }
示例#18
0
        private async Task <FamilyTreeDTO> GetRelatedPeople(Person childPerson, FamilyTreeDTO familyTree)
        {
            var personsQueue = new Queue <Person>();

            familyTree.Family = new List <FamilyTreeDTO>();

            // get all related persons
            var relatedPeople = await RepositoryDbContext.Set <Domain.PersonInRelationship>()
                                .Include(i => i.Person)
                                .Include(i => i.Person1)
                                .Include(i => i.Relationship)
                                .Where(w => w.PersonId == childPerson.Id)
                                .Select(e => e.Person1).Distinct().ToListAsync();

            IdsToExclude.Add(childPerson.Id);

            familyTree.Id        = childPerson.Id;
            familyTree.FirstName = childPerson.FirstName;
            familyTree.LastName  = childPerson.LastName;
            familyTree.Age       = childPerson.Age;

            foreach (var person in relatedPeople.Where(person => !IdsToExclude.Contains(person.Id)))
            {
                personsQueue.Enqueue(person);
            }

            while (personsQueue.Count != 0)
            {
                var personToCheck = personsQueue.Dequeue();
                familyTree.Family.Add(await GetRelatedPeople(personToCheck, new FamilyTreeDTO()));
            }

            return(familyTree);
        }
示例#19
0
        private async Task GetParents(Person child, int initialPersonId)
        {
            var query = RepositoryDbContext.Set <Domain.PersonInRelationship>()
                        .Include(i => i.Relationship)
                        .Where(w => w.Person1 == child);

            var mom = await query.Where(w => w.Relationship.Relation == Relation.Ema).Select(e => e.Person)
                      .FirstOrDefaultAsync();

            var dad = await query.Where(w => w.Relationship.Relation == Relation.Isa).Select(e => e.Person)
                      .FirstOrDefaultAsync();

            if (!PersonFirstNameMissing(mom))
            {
                RelationsCounter += 1;
                RelatedPersonsIds[initialPersonId].Add(mom);
                await GetParents(mom, initialPersonId);
            }

            if (!PersonFirstNameMissing(dad))
            {
                RelationsCounter += 1;
                RelatedPersonsIds[initialPersonId].Add(dad);
                await GetParents(dad, initialPersonId);
            }
        }
示例#20
0
        public override async Task <DAL.App.DTO.ProductService> FindAsync(params object[] id)
        {
            var culture = Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2).ToLower();

            var productService = await RepositoryDbSet.FindAsync(id);

            if (productService != null)
            {
                await RepositoryDbContext.Entry(productService)
                .Reference(c => c.ProductForClient)
                .LoadAsync();

                await RepositoryDbContext.Entry(productService)
                .Reference(c => c.WorkObject)
                .LoadAsync();

                await RepositoryDbContext.Entry(productService)
                .Reference(c => c.Description)
                .LoadAsync();

                await RepositoryDbContext.Entry(productService.Description)
                .Collection(b => b.Translations)
                .Query()
                .Where(t => t.Culture == culture)
                .LoadAsync();
            }

            return(ProductServiceMapper.MapFromDomain(productService));
        }
示例#21
0
 public void UpdateEntity(TEntity entity, bool isSave = true)
 {
     if (isSave)
     {
         RepositoryDbContext.SaveChanges();
     }
 }
示例#22
0
 /// <summary>
 /// 获取油烟设备型号信息
 /// </summary>
 /// <returns></returns>
 public static List <LampblackDeviceModel> GetDeviceModels()
 {
     using (var context = new RepositoryDbContext())
     {
         return(context.Set <LampblackDeviceModel>().ToList());
     }
 }
示例#23
0
 public void DeleteEntity(TEntity entity, bool isSave = true)
 {
     Entities.Remove(entity);
     if (isSave)
     {
         RepositoryDbContext.SaveChanges();
     }
 }
 public RepositoriesViewModel()
 {
     dbContext         = new RepositoryDbContext();
     repSource         = dbContext.Repositories.ToList();
     SourceUser        = new FtpUser();
     TargetUser        = new FtpUser();
     this.Repositories = new ObservableCollection <Repository>(repSource);
 }
        public async Task CanCreateUserAccessToken()
        {
            var user = TestDataUtil
                       .AddUser().GetLast <User>();

            _userAccessTokenRepository.Add(CreateUserAccessToken(user));
            await RepositoryDbContext.SaveChangesAsync();
        }
示例#26
0
 public void InsertEntity(TEntity entity, bool isSave = true)
 {
     Entities.Add(entity);
     if (isSave)
     {
         RepositoryDbContext.SaveChanges();
     }
 }
 public List <HotelCleaness> GetHotelCleanessList()
 {
     using (var context = new RepositoryDbContext())
     {
         ((IObjectContextAdapter)context).ObjectContext.CommandTimeout = 180;
         var checkDate     = DateTime.Now.AddMinutes(-2);
         var commandDataId =
             context.Set <CommandData>().First(obj => obj.DataName == ProtocolDataName.CleanerCurrent).Id;
         var modelId   = Guid.Parse("5306DA86-7B7C-40CF-933C-642061C24761");
         var cleanNess = new List <HotelCleaness>();
         foreach (var hotel in context.Set <HotelRestaurant>())
         {
             var devs =
                 context.Set <Device>().Where(dev => dev.ProjectId == hotel.Id).Select(item => item.Identity).ToList();
             var lastProtocol =
                 context.Set <ProtocolData>()
                 .Where(d => devs.Contains(d.DeviceIdentity))
                 .OrderByDescending(dat => dat.UpdateTime)
                 .FirstOrDefault();
             if (lastProtocol != null && lastProtocol.UpdateTime >= checkDate)
             {
                 var hotelData = context.Set <MonitorData>().FirstOrDefault(d => d.ProjectIdentity == hotel.Identity &&
                                                                            d.ProtocolDataId == lastProtocol.Id &&
                                                                            d.CommandDataId == commandDataId);
                 if (hotelData == null)
                 {
                     cleanNess.Add(new HotelCleaness
                     {
                         DistrictGuid    = hotel.DistrictId,
                         ProjectName     = hotel.ProjectName,
                         ProjectCleaness = "无数据"
                     });
                 }
                 else
                 {
                     cleanNess.Add(new HotelCleaness
                     {
                         DistrictGuid    = hotel.DistrictId,
                         ProjectName     = hotel.ProjectName,
                         ProjectCleaness = hotelData.DoubleValue != null
                     ? GetCleanRateByDeviceModel(hotelData.DoubleValue, modelId)
                     : "无数据"
                     });
                 }
             }
             else
             {
                 cleanNess.Add(new HotelCleaness
                 {
                     DistrictGuid    = hotel.DistrictId,
                     ProjectName     = hotel.ProjectName,
                     ProjectCleaness = "无数据"
                 });
             }
         }
         return(cleanNess);
     }
 }
示例#28
0
 /// <summary>
 /// 刷新权限信息缓存
 /// </summary>
 public static void RefreashPermissions()
 {
     using (var context = new RepositoryDbContext())
     {
         PlatformCaches.DeleteCachesByName("Permissions");
         var permissions = context.Set <Permission>().ToList();
         PlatformCaches.Add("Permissions", permissions, false, "System");
     }
 }
        static void Main(string[] args)
        {
            Console.WriteLine("Creating Default Db Context");

            //To connect to an sql or azure sql server jusr use: UseSqlServer(connectionString)
            var options = new DbContextOptionsBuilder <RepositoryDbContext>()
                          .UseSqlite("Data Source=endavaUniversity.db")
                          //.UseLoggerFactory(loggerFactory)
                          .Options;

            using (var db = new RepositoryDbContext(options))
            {
                // Create
                var user = new User
                {
                    FirstName = "Maria",
                    LastName  = "Antuanetta"
                };
                Console.WriteLine($"Inserting a new user: {user.FirstName} {user.LastName}.");
                db.Add(user);
                db.SaveChanges();

                // Read
                Console.WriteLine("Querying for a user");
                var returnedUser = db.Users
                                   .OrderBy(u => u.Id)
                                   .Where(u => u.FirstName.Equals(user.FirstName)).First();
                Console.WriteLine($"User: {returnedUser.FirstName} {returnedUser.LastName}; Id: {returnedUser.Id}");

                // Update
                Console.WriteLine("Updating the user (Carlos) and adding a wallet");
                returnedUser.LastName = "Carlos";
                returnedUser.Wallets.Add(
                    new Wallet
                {
                    Amount   = 100,
                    Currency = "USD",
                });
                db.SaveChanges();

                // Read
                Console.WriteLine("Querying for an updated user");
                var updatedUser = db.Users
                                  .OrderBy(u => u.Id)
                                  .Where(u => u.FirstName.Equals(user.FirstName)).First();
                Console.WriteLine($"User: {updatedUser.FirstName} {updatedUser.LastName}; Id: {updatedUser.Id}");

                Console.WriteLine($"User' wallet Id: {updatedUser.Wallets.First()?.Id}");
                Console.WriteLine($"Wallet' user Id: {updatedUser.Wallets.First()?.UserId}");

                // Delete
                Console.WriteLine("Delete the user");
                db.Remove(updatedUser);
                db.SaveChanges();
            }
        }
示例#30
0
        public override Event Update(Event entity)
        {
            var dbUnit = RepositoryDbContext.AdministrativeUnitInEvents.Where(item => item.EventId == entity.Id).ToList();

            RepositoryDbContext.RemoveRange(dbUnit);
            var dbType = RepositoryDbContext.EventInTypes.Where(item => item.EventId == entity.Id).ToList();

            RepositoryDbContext.RemoveRange(dbType);
            return(EventMapper.MapFromDomain(RepositoryDbSet.Update(EventMapper.MapFromDAL(entity)).Entity));
        }