Esempio n. 1
0
        public async Task <IActionResult> Create(AddressDTO addressDTO)
        {
            if (ModelState.IsValid)
            {
                _repositoryWrapper.Address.CreateAddress(_mapper.Map <Address>(addressDTO));
                await _repositoryWrapper.SaveAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(nameof(Create), addressDTO));
        }
Esempio n. 2
0
        /// <inheritdoc />
        public async Task <ClubDTO> UpdateAsync(ClubDTO club)
        {
            var editedClub = _mapper.Map <ClubDTO, DataAccessClub.Club>(club);

            editedClub.Logo = await UploadPhotoAsyncFromBase64(club.ID, club.Logo);

            _repoWrapper.Club.Update(editedClub);
            await _repoWrapper.SaveAsync();

            return(_mapper.Map <DataAccessClub.Club, ClubDTO>(editedClub));
        }
Esempio n. 3
0
        public async Task <IActionResult> CreateCategory([FromBody] CategoryCreationDto category)
        {
            var categoryEntity = _mapper.Map <Category>(category);

            _repository.Category.CreateCategory(categoryEntity);
            await _repository.SaveAsync();

            var createdCategory = _mapper.Map <CategoryDto>(categoryEntity);

            return(CreatedAtRoute("CategoryById", new { id = createdCategory.categoryId }, createdCategory));
        }
Esempio n. 4
0
        public async Task AddDistinctionAsync(DistinctionDTO distinctionDTO, ClaimsPrincipal user)
        {
            if (!user.IsInRole("Admin"))
            {
                throw new UnauthorizedAccessException();
            }
            var distinction = _mapper.Map <DistinctionDTO, Distinction>(distinctionDTO);
            await _repoWrapper.Distinction.CreateAsync(distinction);

            await _repoWrapper.SaveAsync();
        }
Esempio n. 5
0
        public async Task <IActionResult> Create(CustomerManagementDTO customerManagementDTO)
        {
            if (ModelState.IsValid)
            {
                _repositoryWrapper.Customer.CreateCustomer(_mapper.Map <Customer>(customerManagementDTO));
                await _repositoryWrapper.SaveAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(customerManagementDTO));
        }
        public async Task<RegionAdministrationDTO> AddAdministratorAsync(RegionAdministrationDTO adminDTO)
        {
            var adminType = await _adminTypeService.GetAdminTypeByNameAsync(adminDTO.AdminType.AdminTypeName);
            adminDTO.AdminTypeId = adminType.ID;

            var admin = _mapper.Map<RegionAdministrationDTO, RegionAdministration>(adminDTO);
            
            await _repositoryWrapper.RegionAdministration.CreateAsync(admin);
            await _repositoryWrapper.SaveAsync();

            return adminDTO;
        }
Esempio n. 7
0
        public async Task <IActionResult> Create(ServiceDTO serviceDTO)
        {
            if (ModelState.IsValid)
            {
                var result = _mapper.Map <Service>(serviceDTO);
                _repositoryWrapper.Service.CreateService(result);
                await _repositoryWrapper.SaveAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(nameof(Create), serviceDTO));
        }
Esempio n. 8
0
        public async Task <Position> AddPositionAsync(Position position)
        {
            Position createdPosition = new Position();

            createdPosition.PositionName = position.PositionName;
            createdPosition.Salary       = position.Salary;

            _repositoryWrapper.PositionRepository.Add(createdPosition);
            await _repositoryWrapper.SaveAsync();

            return(createdPosition);
        }
Esempio n. 9
0
        /// <inheritdoc />
        public async Task DeleteUserAsync(string userId)
        {
            User user = await _repoWrapper.User.GetFirstOrDefaultAsync(x => x.Id == userId);

            var roles = await _userManager.GetRolesAsync(user);

            if (user != null && !roles.Contains("Admin"))
            {
                _repoWrapper.User.Delete(user);
                await _repoWrapper.SaveAsync();
            }
        }
Esempio n. 10
0
        /// <inheritdoc />
        public async Task <ClubMembersDTO> ToggleIsApprovedInClubMembersAsync(int memberId, int clubId)
        {
            var person =
                await _repoWrapper.ClubMembers.GetFirstOrDefaultAsync(u => u.ID == memberId && u.ClubId == clubId) ??
                throw new ArgumentNullException($"User with id={memberId} not found");

            person.IsApproved = !person.IsApproved;
            _repoWrapper.ClubMembers.Update(person);
            await _repoWrapper.SaveAsync();

            return(_mapper.Map <ClubMembers, ClubMembersDTO>(person));
        }
        public async Task <IActionResult> AddCake(Cake cake)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            await _repositoryWrapper.Cake.CreateAsync(cake);

            await _repositoryWrapper.SaveAsync();

            return(Ok());
        }
Esempio n. 12
0
        /// <inheritdoc />
        public async Task RemoveAsync(int ClubId)
        {
            var Club = await _repoWrapper.Club.GetFirstOrDefaultAsync(c => c.ID == ClubId);

            if (Club.Logo != null)
            {
                await _ClubBlobStorage.DeleteBlobAsync(Club.Logo);
            }

            _repoWrapper.Club.Delete(Club);
            await _repoWrapper.SaveAsync();
        }
Esempio n. 13
0
        public async Task <IActionResult> AddProduct(Product product)
        {
            if (!ModelState.IsValid)
            {
                return(Problem("Invalid action!"));
            }
            await _repositoryWrapper.Product.CreateAsync(product);

            await _repositoryWrapper.SaveAsync();

            return(Ok());
        }
        public async Task <IActionResult> CreatePhysiologicalSignal([FromBody] PhysiologicalSignalRequest physiologicalSignalRequest)
        {
            if (physiologicalSignalRequest == null)
            {
                _logger.LogError("CreatePhysiologicalSignal: PhysiologicalSignalRequest object sent from client is null.");
                return(BadRequest("PhysiologicalSignalRequest object is null"));
            }
            if (!ModelState.IsValid)
            {
                _logger.LogError("CreatePhysiologicalSignal: Invalid PhysiologicalSignalRequest object sent from client.");
                return(BadRequest("Invalid PhysiologicalSignalRequest object"));
            }
            string userId = HttpContext.User.Claims.Single(x => x.Type == "id").Value;
            string role   = HttpContext.User.Claims.Single(x => x.Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/role").Value;

            if (role == Role.SubAdministratorRole)
            {
                if (!await ParticipantInOrganizationOfUserIdAsync(physiologicalSignalRequest.ParticipantId, userId))
                {
                    return(BadRequest("A sub-administrator can create only psychological signals of a participant of own organization"));
                }
            }
            else if (role == Role.SupervisorRole)
            {
                if (!await ParticipantInStudiesOfUserIdAsync(physiologicalSignalRequest.ParticipantId, userId))
                {
                    return(BadRequest("A supervisor can create only psychological signals of a participant of own studies"));
                }
            }
            else if (role == Role.ParticipantRole)
            {
                if (!await ParticipantSameAsUserIdAsync(physiologicalSignalRequest.ParticipantId, userId))
                {
                    return(BadRequest("A participant can create only own psychological signals"));
                }
            }
            else if (role == Role.TherapistRole)
            {
                var participant = await _coadaptService.Participant.GetParticipantByIdAsync(physiologicalSignalRequest.ParticipantId);

                if (!await ParticipantMonitoredByTherapistOfUserIdAsync(participant, userId))
                {
                    return(BadRequest("A therapist can create only psychological signals of monitored participants"));
                }
            }
            var physiologicalSignal = new PhysiologicalSignal();

            physiologicalSignal.FromRequest(physiologicalSignalRequest);
            _coadaptService.PhysiologicalSignal.CreatePhysiologicalSignal(physiologicalSignal);
            await _coadaptService.SaveAsync();

            return(CreatedAtRoute("PhysiologicalSignalById", new { id = physiologicalSignal.Id }, physiologicalSignal));
        }
        public async Task <IActionResult> CreateOwner([FromBody] OwnerCreationDto owner)
        {
            var ownerEntity = _mapper.Map <Owner>(owner);

            _repository.Owner.CreateOwner(ownerEntity);

            await _repository.SaveAsync();

            var createdOwner = _mapper.Map <OwnerDto>(ownerEntity);

            return(CreatedAtRoute("OwnerById", new { id = createdOwner.Id }, createdOwner));
        }
Esempio n. 16
0
        public async Task <IActionResult> CreateOuraReadiness([FromBody] OuraReadinessRequest ouraReadinessRequest)
        {
            if (ouraReadinessRequest == null)
            {
                _logger.LogError("CreateOuraReadiness: OuraReadinessRequest object sent from client is null.");
                return(BadRequest("OuraReadinessRequest object is null"));
            }
            if (!ModelState.IsValid)
            {
                _logger.LogError("CreateOuraReadiness: Invalid OuraReadinessRequest object sent from client.");
                return(BadRequest("Invalid OuraReadinessRequest object"));
            }
            string userId = HttpContext.User.Claims.Single(x => x.Type == "id").Value;
            string role   = HttpContext.User.Claims.Single(x => x.Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/role").Value;

            if (role == Role.SubAdministratorRole)
            {
                if (!await ParticipantInOrganizationOfUserIdAsync(ouraReadinessRequest.ParticipantId, userId))
                {
                    return(BadRequest("A sub-administrator can create only oura readinesses of a participant of own organization"));
                }
            }
            else if (role == Role.SupervisorRole)
            {
                if (!await ParticipantInStudiesOfUserIdAsync(ouraReadinessRequest.ParticipantId, userId))
                {
                    return(BadRequest("A supervisor can create only oura readinesses of a participant of own studies"));
                }
            }
            else if (role == Role.ParticipantRole)
            {
                if (!await ParticipantSameAsUserIdAsync(ouraReadinessRequest.ParticipantId, userId))
                {
                    return(BadRequest("A participant can create only own oura readinesses"));
                }
            }
            else if (role == Role.TherapistRole)
            {
                var participant = await _coadaptService.Participant.GetParticipantByIdAsync(ouraReadinessRequest.ParticipantId);

                if (!await ParticipantMonitoredByTherapistOfUserIdAsync(participant, userId))
                {
                    return(BadRequest("A therapist can create only oura readinesses of monitored participants"));
                }
            }
            var ouraReadiness = new OuraReadiness();

            ouraReadiness.FromRequest(ouraReadinessRequest);
            _coadaptService.OuraReadiness.CreateOuraReadiness(ouraReadiness);
            await _coadaptService.SaveAsync();

            return(CreatedAtRoute("OuraReadinessById", new { id = ouraReadiness.Id }, ouraReadiness));
        }
        public async Task <int> CreateAsync(GoverningBodyDTO governingBodyDto)
        {
            await UploadPhotoAsync(governingBodyDto);

            var governingBody = await CreateGoverningBodyAsync(governingBodyDto);

            _repoWrapper.GoverningBody.Attach(governingBody);
            await _repoWrapper.GoverningBody.CreateAsync(governingBody);

            await _repoWrapper.SaveAsync();

            return(governingBody.ID);
        }
Esempio n. 18
0
        public async Task <IActionResult> CreateOrder([FromBody] OrderForCreationDTO order)
        {
            if (order is null)
            {
                logger.LogError("Order object sent from client is null");
                return(BadRequest("Order object is null"));
            }
            repository.Order.CreateOrder(mapper.Map <OrderForCreationDTO, Order>(order));
            await repository.SaveAsync();

            logger.LogInfo("Order succesfully created");
            return(Ok());
        }
Esempio n. 19
0
        public static async Task InitializeDatabaseAsync(IRepositoryWrapper repositoryWrapper)
        {
            if (repositoryWrapper.Category.GetAllAsync().Result.Count() == 0 &&
                repositoryWrapper.Cake.GetAllAsync().Result.Count() == 0)
            {
                var cakeCategory = new Category
                {
                    Name = "Cake"
                };

                await repositoryWrapper.Category.CreateAsync(cakeCategory);

                var pieceOfCakeCategory = new Category
                {
                    Name = "PieceOfCake"
                };

                await repositoryWrapper.Category.CreateAsync(pieceOfCakeCategory);

                await repositoryWrapper.SaveAsync();

                var regal = new Cake
                {
                    Name            = "Regal Cake",
                    Description     = "Our special cake will make you love it!",
                    CategoryId      = cakeCategory.Id,
                    ImageUrl        = "/img/tort-mousse-ciocolata.jpg",
                    IsCakeOfTheWeek = true,
                    Price           = 97,
                    Weigth          = "1000",
                    Stock           = 10
                };

                await repositoryWrapper.Cake.CreateAsync(regal);

                var tiramisu = new Cake
                {
                    Name            = "Tiramisu",
                    Description     = "Tiramisu is a cool, refreshing Italian dessert that once tasted, leaves an indelible impression on you.",
                    CategoryId      = pieceOfCakeCategory.Id,
                    ImageUrl        = "/img/prajitura-tiramisu.jpg",
                    IsCakeOfTheWeek = true,
                    Price           = 16,
                    Weigth          = "120",
                    Stock           = 21
                };
                await repositoryWrapper.Cake.CreateAsync(tiramisu);

                await repositoryWrapper.SaveAsync();
            }
        }
Esempio n. 20
0
        public async Task ChangeCurrentRoleAsync(string userId, string role)
        {
            const string supporter      = Roles.Supporter;
            const string plastun        = Roles.PlastMember;
            const string interested     = Roles.Interested;
            const string formerMember   = Roles.FormerPlastMember;
            const string registeredUser = Roles.RegisteredUser;
            var          user           = await _userManager.FindByIdAsync(userId);

            var roles = await _userManager.GetRolesAsync(user);

            switch (role)
            {
            case supporter:
            case plastun:
            case interested:
            case registeredUser:
                if (roles.Contains(supporter))
                {
                    await _userManager.RemoveFromRoleAsync(user, supporter);
                }
                else if (roles.Contains(plastun))
                {
                    await _userManager.RemoveFromRoleAsync(user, plastun);
                }
                else if (roles.Contains(interested))
                {
                    await _userManager.RemoveFromRoleAsync(user, interested);
                }
                else if (roles.Contains(formerMember))
                {
                    await _userManager.RemoveFromRoleAsync(user, formerMember);
                }
                else
                {
                    await _userManager.RemoveFromRoleAsync(user, registeredUser);
                }
                await UpdateUserDatesByChangeRoleAsyncAsync(userId, role);

                await _repoWrapper.SaveAsync();

                await _userManager.AddToRoleAsync(user, role);

                break;

            case formerMember:
                await ChangeAsync(userId);

                break;
            }
        }
Esempio n. 21
0
        public async Task <ActionResult <BookDTO> > CreateBook([FromBody] BookDTO book)
        {
            var conBook = _mapper.Map <Book>(book);

            var newBook = new Book()
            {
                Blurb         = book.Blurb,
                Depth         = book.Depth,
                Format        = book.Format,
                Height        = book.Height,
                Image         = book.Image,
                NumberofPages = book.NumberofPages,
                PublishedDate = book.PublishedDate,
                Title         = book.Title,
                Type          = book.Type,
                Width         = book.Width,
                Weight        = book.Weight,
                Genres        = new List <Genre>(),
                Authors       = new List <Author>()
            };

            // First create the book with no relations -> Will take relations as new objects too which they are not.
            _wrapper.BookRepository.CreateBook(newBook);

            try
            {
                await _wrapper.SaveAsync();
            }
            catch (DbUpdateException e)
            {
                return(BadRequest(e.Message));
            }

            // Add relations
            newBook.Authors.AddRange(conBook.Authors);
            newBook.Genres.AddRange(conBook.Genres);

            // Update the model
            _wrapper.BookRepository.Update(newBook);

            try
            {
                await _wrapper.SaveAsync();
            }
            catch (DbUpdateException e)
            {
                return(BadRequest(e.Message));
            }

            return(CreatedAtAction(nameof(CreateBook), new { id = book.BookId }, book));
        }
Esempio n. 22
0
        /// <inheritdoc />
        public async Task <bool> DeleteClubAdminAsync(int id)
        {
            var clubAdministration = await _repoWrapper.ClubAdministration.GetFirstOrDefaultAsync(i => i.ID == id);

            if (clubAdministration == null)
            {
                throw new ArgumentNullException($"ClubAdministration with {id} ID not found");
            }

            _repoWrapper.ClubAdministration.Delete(clubAdministration);
            await _repoWrapper.SaveAsync();

            return(true);
        }
Esempio n. 23
0
        public async Task <bool> AddEquity(string userId, Equity equity)
        {
            var portfolio = _repo.Portfolios.FindById <Portfolio>(equity.PortfolioId);

            if (portfolio?.UserId != userId)
            {
                return(false);
            }

            _repo.Equities.Create(equity);
            var res = await _repo.SaveAsync();

            return(res);
        }
        public async Task <APIResponse> Handle(UpdateVendorQuestionAnswerCommand request, CancellationToken cancellationToken)
        {
            try
            {
                List <Vendorquestionanswers> vendorquestionanswers = new List <Vendorquestionanswers>();

                ArrayList qIdList = new ArrayList();

                foreach (var item in request.UpdateVendorQusetionAnswerDetailsRequest.UpdateVendorQuestionAnswers)
                {
                    var vendorquestionanswerrequest = mapper.Map <Vendorquestionanswers>(item);

                    if (vendorquestionanswerrequest.VendorLeadId == null)
                    {
                        vendorquestionanswerrequest.VendorLeadId = request.VendorleadId;
                    }
                    vendorquestionanswerrequest.CreatedAt = DateTime.UtcNow;
                    vendorquestionanswerrequest.CreatedBy = (int)vendorquestionanswerrequest.UpdatedBy;
                    vendorquestionanswerrequest.UpdatedAt = null;
                    vendorquestionanswerrequest.UpdatedBy = null;

                    vendorquestionanswers.Add(vendorquestionanswerrequest);

                    if (!qIdList.Contains(vendorquestionanswerrequest.QuestionId))
                    {
                        qIdList.Add(vendorquestionanswerrequest.QuestionId);
                    }
                }

                for (int i = 0; i <= (qIdList.Count - 1); i++)
                {
                    var vendorquestionanswerList = await repository.VendorQuestionAnswer.GetVendorQuestionAnswers(request.VendorleadId, (int)qIdList[i]);

                    repository.VendorQuestionAnswer.UpdateVendorQuestionAnswer(vendorquestionanswerList);

                    await repository.SaveAsync();
                }

                repository.VendorQuestionAnswer.CreateVendorQuestionAnswer(vendorquestionanswers);
                await repository.SaveAsync();

                return(new APIResponse(HttpStatusCode.NoContent));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception in method 'UpdateVendorQuestionAnswerHandler()'");
                var exMessage = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                return(new APIResponse(exMessage, HttpStatusCode.InternalServerError));
            }
        }
Esempio n. 25
0
        public async Task <IResult> Handler(CadastrarUsuarioCommand command)
        {
            command.Validate();

            if (!command.Valid)
            {
                return(command.ValidationResult);
            }

            var usuario = await _repository.Usuario.GetUsuarioByNomeAsync(command.Nome);

            if (usuario != null)
            {
                return(new CommandResult(false, "Já existe um usuário com mesmo nome cadastrado", command.Notifications));
            }

            usuario = await _repository.Usuario.GetUsuarioByLoginAsync(command.Login);

            if (usuario != null)
            {
                return(new CommandResult(false, "Login já cadastrado", command.Notifications));
            }

            usuario = await _repository.Usuario.GetUsuarioBySiglaAsync(command.Sigla);

            if (usuario != null)
            {
                return(new CommandResult(false, "Já existe um usuário com a mesma sigla cadastrada", command.Notifications));
            }

            var setor = await _repository.Setor.GetSetorByIdAsync(command.SetorId);

            if (setor == null)
            {
                return(new CommandResult(false, "Setor não encontrado", command.Notifications));
            }

            var usuarioEntity = _mapper.Map <Usuario>(command);

            var passwordEncrypted = _cryptographyService.Encrypt(usuarioEntity.Senha);

            usuarioEntity.Setor = setor;
            usuarioEntity.Senha = passwordEncrypted;

            _repository.Usuario.Create(usuarioEntity);

            await _repository.SaveAsync();

            return(new CommandResult("Usuário cadastrado com sucesso!"));
        }
Esempio n. 26
0
        public async Task <IActionResult> CreatePhoto(PhotoDTO photo)
        {
            if (ModelState.IsValid)
            {
                photo.ImageLink = _imageUploadWrapper.Upload(photo.File, _hostEnvironment);

                _repositoryWrapper.Photo.Create(_mapper.Map <Photo>(photo));

                await _repositoryWrapper.SaveAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(nameof(CreatePhoto), photo));
        }
Esempio n. 27
0
        public async Task CreateMaterial(Material material)
        {
            _repository.Material.CreateMaterial(material);
            await _repository.SaveAsync();

            var materialWarehouseItem = new MaterialWarehouseItem()
            {
                MaterialId = material.MaterialId,
                Quantity   = 0
            };

            _repository.MaterialWarehouseItem.CreateItem(materialWarehouseItem);
            await _repository.SaveAsync();
        }
Esempio n. 28
0
        public async Task <IActionResult> Create(CreateAppointmentDTO appointment)
        {
            if (ModelState.IsValid)
            {
                Appointment app = _mapper.Map <Appointment>(appointment);


                _repositoryWrapper.Appointment.CreateAppointment(app);
                await _repositoryWrapper.SaveAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(nameof(Create), appointment));
        }
Esempio n. 29
0
        public async Task <IActionResult> CreateTaskForProject(Guid projectId, TaskForCreationDto taskForCreation)
        {
            if (taskForCreation.StartDate < DateTime.Today)
            {
                return(BadRequest("Start Date cannot be before today"));
            }

            if (taskForCreation.EndDate < taskForCreation.StartDate)
            {
                return(BadRequest("End Date cannot be before Start Date"));
            }

            var projectFromRepo = await _repository.Project.GetProject(projectId);

            if (projectFromRepo == null)
            {
                return(BadRequest("Project doesn't exist"));
            }

            Status     status;
            Priority   priority;
            Completion percentage;

            Enum.TryParse(taskForCreation.Status, out status);
            Enum.TryParse(taskForCreation.Percentage, out percentage);
            Enum.TryParse(taskForCreation.Priority, out priority);

            var taskToCreate = _mapper.Map <Entities.Models.Task>(taskForCreation);
            var creatorId    = Guid.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier));

            taskToCreate.Priority   = priority;
            taskToCreate.Percentage = percentage;
            taskToCreate.Status     = status;
            taskToCreate.ProjectId  = projectId;
            taskToCreate.CreatorId  = creatorId;

            _repository.Task.CreateTask(taskToCreate);
            var saveTask = await _repository.SaveAsync();

            if (!saveTask)
            {
                throw new Exception("Failed to create task for project");
            }

            var taskToReturn = _mapper.Map <TaskForDetailedDto>(taskToCreate);

            return(CreatedAtRoute("GetTask",
                                  new { projectId = taskToCreate.ProjectId, taskId = taskToCreate.TaskId }, taskToReturn));
        }
Esempio n. 30
0
        public async Task <int> CreateEventAsync(EventCreateDTO model)
        {
            model.Event.EventStatusID = await _eventStatusManager.GetStatusIdAsync("Не затверджені");

            var eventToCreate    = _mapper.Map <EventCreationDTO, Event>(model.Event);
            var commandantTypeId = await _eventAdministrationTypeManager.GetTypeIdAsync("Комендант");

            var alternateTypeId = await _eventAdministrationTypeManager.GetTypeIdAsync("Заступник коменданта");

            var bunchuzhnyiTypeID = await _eventAdministrationTypeManager.GetTypeIdAsync("Бунчужний");

            var pysarTypeId = await _eventAdministrationTypeManager.GetTypeIdAsync("Писар");

            var administrationList = new List <EventAdministration>
            {
                new EventAdministration
                {
                    UserID = model.Сommandant.UserId,
                    EventAdministrationTypeID = commandantTypeId,
                    EventID = eventToCreate.ID,
                },
                new EventAdministration
                {
                    UserID = model.Alternate.UserId,
                    EventAdministrationTypeID = alternateTypeId,
                    EventID = eventToCreate.ID,
                },
                new EventAdministration
                {
                    UserID = model.Bunchuzhnyi.UserId,
                    EventAdministrationTypeID = bunchuzhnyiTypeID,
                    EventID = eventToCreate.ID,
                },
                new EventAdministration
                {
                    UserID = model.Pysar.UserId,
                    EventAdministrationTypeID = pysarTypeId,
                    EventID = eventToCreate.ID,
                },
            };

            eventToCreate.EventAdministrations = administrationList;

            await _repoWrapper.Event.CreateAsync(eventToCreate);

            await _repoWrapper.SaveAsync();

            return(eventToCreate.ID);
        }