public async Task <DepartmentEntity> Update(UpdateDepartmentCmd cmd) { var evt = DepartmentUpdatedEvt.MakeEventEntity(cmd); var insertions = await eventRepo.Create(evt); return(await db.FirstAsync(d => d.Id == evt.Id)); }
public async Task <CompanyEntity> Create(CreateCompanyCmd cmd) { var evtEntity = CompanyCreatedEvt.MakeEventEntity(cmd); var insertions = await eventRepository.Create(evtEntity); if (insertions == 0) { return(null); } return(await db.FirstAsync(c => c.CreatorEventId == evtEntity.Id)); }
public async Task <PermissionEntity> Create(GivePermissionCmd cmd) { var evtEntity = PermissionGivenEvt.MakeEventEntity(cmd); var insertions = await eventRepository.Create(evtEntity); if (insertions == 0) { return(null); } return(await db.FirstAsync(p => p.CreatorEventId == evtEntity.Id)); }
public void UpdateEventTest() { // Arrange HollywoodTestEntities dataContext = new HollywoodTestEntities(); EventRepository eventRepository = new EventRepository(dataContext); Event _event = new Event() { TournamentID = 1, EventName = "Update Event Data Access Unit Test", EventNumber = 1, EventDateTime = Convert.ToDateTime("2019-04-16"), EventEndDateTime = Convert.ToDateTime("2019-06-16"), AutoClose = true, }; // Act int eventId = eventRepository.Create(_event); _event.EventID = eventId; _event.EventName = "Updated Event Data Access Unit Test"; bool isUpdated = eventRepository.Update(_event); // Assert Assert.IsTrue(isUpdated); }
public void CreateItem(Event item) { if (item != null) { _eventRepository.Create(item); } }
/// <summary> /// Crea un usuario, hasheando la contraseña y asegurando que el email no esté ocupado /// </summary> /// <param name="cmd"></param> /// <returns></returns> public async Task <UserEntity> Create(CreateUserCmd cmd) { var evt = UserCreatedEvt.MakeEventEntity(cmd); var insertions = await eventRepository.Create(evt); if (insertions == 0) { return(null); } var user = await db.FirstAsync(u => u.CreatorEventId == evt.Id); var hashedPass = passwordHasher.HashPassword(user, cmd.Password); evt = PasswordChangedEvt.MakeEventEntity(cmd, user.Id, hashedPass); await eventRepository.Create(evt); return(user); }
public void CreateTest() { var mockContext = GetMockContext(); var repository = new EventRepository(mockContext.Object); Assert.Equal(TestEvents.Count(), mockContext.Object.Events.Count()); repository.Create(TestObjects.Event1); Assert.Equal(TestEvents.Count(), repository.Events.Count()); }
public void Create() { Planning planningOutput = _planningRepository.Create(_planningInput); Event eventInput = new Event(0, 1, planningOutput.Id, "label", "20-05-05 00:00:00", "20-05-05 00:00:00"); Event eventOutput = _eventRepository.Create(eventInput); Assert.True(eventOutput != null); }
public IActionResult CreateEvent([FromBody] Event myevent) { try { eventRepository.Create(myevent); return(Ok()); } catch (Exception exe) { return(BadRequest(exe.Message)); } }
public Event Create(string title, string description, string name, string email, bool addOrganizerAsParticipant) { var dbEvent = _repository.Create(title, description, name, email); // by default, add organizer as participant if (addOrganizerAsParticipant) { var dbParticipant = new ParticipantRepository(_dbContext).Add(dbEvent.ID, name, email); dbEvent.Participants.Add(dbParticipant); } return(EntityMapper.Map(dbEvent)); }
public int CreateEvent(EventBL entity) { Event even = new Event { Admin = entity.Admin, IdCityPostalCode = entity.IdCityPostalCode, IdCountry = entity.IdCountry, IdLoisir = entity.IdLoisir, Name = entity.Name, Time = entity.Time }; return(service.Create(even)); }
public void CreateEventTest() { // Arrange HollywoodTestEntities dataContext = new HollywoodTestEntities(); EventRepository eventRepository = new EventRepository(dataContext); Event _event = new Event() { TournamentID = 1, EventName = "Create Event Data Access Unit Test", EventNumber = 1, EventDateTime = Convert.ToDateTime("2019-04-16"), EventEndDateTime = Convert.ToDateTime("2019-06-16"), AutoClose = true, }; // Act int eventId = eventRepository.Create(_event); // Assert Assert.AreNotEqual(eventId, 0); }
private async Task AsyncEvent() { try { var ListEvent = await restClient.Get <List <Event> >("events"); var repository = new EventRepository(_connection); var ListEventLite = repository.GetAll(); var ListTemp = ListEvent.Where(x => !ListEventLite.Select(y => y.EventId).Contains(x.EventId)).ToList().ConvertToListEventLite(); if (ListTemp.Any()) { foreach (var item in ListTemp) { repository.Create(item); } } } catch { } }
public ActionResult SendUserInfo([FromBody] UserInfoDto userInfoDto) { var client = new MongoClient("mongodb://localhost:27017"); var database = client.GetDatabase("HackathonDb"); var placeRepository = new PlaceRepository(database); var eventRepository = new EventRepository(database); Console.WriteLine(userInfoDto.Token); Console.WriteLine(userInfoDto.UserId); var items = VkApiRequester.GetAllEvents( $"https://api.vk.com/method/groups.search?q=.&city_id=49&count=100&type=event&user_id={userInfoDto.UserId}&access_token={userInfoDto.Token}&v={apiVersion}"); var result = VkApiRequester.GetEventsDetails( $"https://api.vk.com/method/groups.getById?group_ids={string.Join(',', items.Select(i => i.Id))}&fields=place,description,finish_date,name&user_id={userInfoDto.UserId}&access_token={userInfoDto.Token}&v={apiVersion}"); foreach (var item in result) { Console.WriteLine(0); eventRepository.Create(new Event() { Description = item.Description, Id = Guid.NewGuid(), Name = item.Name, Date = new DateTime(item.FinishDate) //TimeSpan.FromSeconds(item.FinishDate) }); if (item.Place == null) { continue; } Console.WriteLine(1); placeRepository.Create(new ChillMapWeb.Entities.Place() { Id = Guid.NewGuid(), Name = item.Place.Title, Address = item.Place.Address }); } return(Ok()); }
public async Task <ReportEntity> Update(ReportRequest request, long idreport, long idUser) { var evt = new EventEntity() { UserId = idUser, Body = new ReportUpdatedEvt() { Id = idreport, Observation = request.Observation, Operative = request.Operative, Financial = request.Financial } }; var updating = await _eventRepository.Create(evt); if (updating == 0) { return(null); } else { return(db.Include(r => r.User).Include(r => r.Files).Include(r => r.Seen).First(r => r.Id == idreport)); } }
public void Create_Event() { var repo = new EventRepository(); var newEvent = new Event { Id = 2, Subject = "test", Body = "body", Category = new Category { Id = 1 }, CreatedBy = new User { Id = 1, Email = "*****@*****.**" }, Date = DateTime.Today, From = DateTime.Now.AddHours(-1).TimeOfDay, To = DateTime.Now.AddHours(1).TimeOfDay, }; repo.Create(newEvent); }
public async Task <IActionResult> Create(EventCRUDDto eventDto) { return(Ok(await _eventRepository.Create(eventDto))); }
public Event CreateEvent(Event newEvent) { ValidateNewEvent(newEvent); return(EventRepository.Create(newEvent)); }
public void Add(Events entity) { _eventRepository.Create(entity); }
public void Fill() { var names = new List <string> { "Концерт Егора Крида. 16+", "Хакатон 2019", "ДММ Концерт", "День открытых дверей в колледж имени Ползунова", "Митинг в поддержку Сергея Зверева", "Вечеринка у Скриптонита", "Дегустация чешского пива", "Парад воздушных шаров", "Акция \"Зелёная планета\"", "Распродажа коллекции летней румынской обуви. Сезон 2016" }; var descriptions = new List <string> { "Приезжает лучший певец современности", "Обязательно для посещения. Там кормят :)", "Нету места лучше в мире, чем Тургенева 4. Пиво, в...", "Успех обеспечен", "За мужика!", "МЫныынвынлилыы", "Из Рязани", "Разноцветные", "Вырубаем деревья", "Дешово, беры" }; var events = Enumerable .Range(0, 10) .Select(i => new Event() { Name = $"{names[i]}", Description = $"{descriptions[i]}", Date = DateTime.Now }) .ToList(); foreach (var event_ in events) { eventRep.Create(event_); } var addreses = new List <string> { "Мичурина, 28", "Ленина, 54", "Мира, 8", "Бажова, 17", "Ватутина, 5", }; var placeNames = new List <string>() { "Дом культуры им. Сергея Зайцева", "Консульство им. Ратбек Нурланова", "Дом ветеранов им. маршала-генералисимуса Василия Пахомова", "Центр современного искусства им. Леры Усольцевой", "Штаб-квартира организаций ChillHack им. Полины Дубровиной" }; var paths = new List <string> { "https://b1.culture.ru/c/792421.jpg", "http://dalniestrany.ru/images/stories/Countries/SNG/Kirgiziya/%D0%9F%D0%BE%D1%81%D0%BE%D0%BB%D1%8C%D1%81%D1%82%D0%B2%D0%BE%20%D0%9A%D0%B8%D1%80%D0%B3%D0%B8%D0%B7%D0%B8%D0%B8%20%D0%B2%20%D0%9C%D0%BE%D1%81%D0%BA%D0%B2%D0%B5%20(%D1%83%D0%BB.%20%D0%91%D0%BE%D0%BB%D1%8C%D1%88%D0%B0%D1%8F%20%D0%9E%D1%80%D0%B4%D1%8B%D0%BD%D0%BA%D0%B0,%20%D0%B4.64).jpg", "https://360tv.ru/media/article_media/20141203/b2b37cd7.jpg", "http://www.historie.ru/uploads/posts/2066/galisiyskiy-centr-sovremennogo-iskusstva-foto-opisanie-centro-galego-de-arte-contemporanea-132847.jpg", "https://4.bp.blogspot.com/-xWpCvIFcXwE/XAtum6tuq-I/AAAAAAAAtbM/PwzWA3Eqfpkd8Cl3GapQ1wITv9lXaJ0agCLcBGAs/s1600/Avengers-Endgame-10.jpg" }; var places = Enumerable .Range(0, 5) .Select(i => new Place() { Name = placeNames[i], Address = addreses[i], Description = "", Events = new List <Event>() { events[i], events[i + 5] }, Id = Guid.NewGuid(), Path = paths[i] }).ToList(); foreach (var place in places) { placeRep.Create(place); } districtRep.Create(new District(new Guid(), places, "Центр")); }
public void Create(Event obj) { _eventRepository.Create(obj); }