public ActionResult Create() { var repo = new EventRepository(); var addEventViewModel = repo.CreateEvent(); return(View(addEventViewModel)); }
public IActionResult CreateEvent([FromBody] Event ev) { //byte[] arrr = new byte[Request.Body.Length]; //Request.Body.Read(arrr, 0, Convert.ToInt32(Request.Body.Length)); //string data = System.Text.Encoding.UTF8.GetString(arrr); repo = new EventRepository(); return(Ok(repo.CreateEvent(ev))); }
public void ShouldGoToEvent() { var user = new User { Age = 18, City = "Питер", Email = "*****@*****.**", Name = "Марина", Surname = "Купцова", Password = "******", }; var file = new File { Bytes = new byte[0], FileExtension = ".jpg", Filename = "fotka" }; var creativeteam = new CreativeTeam(); creativeteam.About = "test"; creativeteam.Email = "*****@*****.**"; creativeteam.Genre = "rock/hardcore/post-punk"; creativeteam.Name = "testband"; creativeteam.Password = "******"; creativeteam.Rating = 3.2; creativeteam.SubscribersCount = 0; var teamevent = new Event { Place = "СПб", DateAndTime = DateTime.Now, Description = "", ParticipantCount = 13 }; var Bytes = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }; var FileExtension = ".jpeg"; var Filename = "test.jpeg"; var usersRepository = new UserRepository(_connectionString); var eventRepository = new EventRepository(_connectionString); var creativeteamRepository = new CreativeTeamRepository(_connectionString); var newcreativeteam = creativeteamRepository.CreateCreativeTeam(creativeteam, Bytes, Filename); _tempCreativeTeam.Add(newcreativeteam.Id); var newuser = usersRepository.CreateUser(user, file); _tempUsers.Add(newuser.Id); var newevent = eventRepository.CreateEvent(teamevent, Bytes, Filename, newcreativeteam.Id); _tempEvents.Add(newevent.Id); usersRepository.GoToEvent(newuser.Id, newevent.Id); }
public IActionResult CreateEvent(NewEventWithInvites NewEvent) { var newMovie = _movieRepository.CreateMovie(NewEvent); var newCreatedEvent = _eventRepository.CreateEvent(NewEvent, newMovie.MovieId); foreach (var userId in NewEvent.InvitedUsers) { _inviteRepository.CreateInvite(userId, newCreatedEvent.EventId); var emailAddress = _userRepository.GetEmail(userId); var movieTitle = _movieRepository.GetMovieTitle(newMovie.MovieId); _twilioRepository.Other(emailAddress, movieTitle); } return(Ok(newCreatedEvent)); }
public void ShouldUpdateEvent() { var creativeteam = new CreativeTeam { About = "test", Email = "*****@*****.**", Genre = "rock/hardcore/post-punk", Name = "testband", Password = "******", Rating = 3.2, SubscribersCount = 0 }; var photo = new File { Bytes = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, FileExtension = ".jpeg", Filename = "test.jpeg" }; var newEvent = new Event { DateAndTime = DateTime.Now, Description = "Big concert on the street of your city!", ParticipantCount = 0, Place = "Saint-Petersburg, Russia" }; var file = new File { Bytes = new byte[] { 1, 12, 123, 13 }, FileExtension = ".jpg", Filename = "fotka" }; var creativeteamRepository = new CreativeTeamRepository(_connectionString); var newcreativeteam = creativeteamRepository.CreateCreativeTeam(creativeteam, photo.Bytes, photo.Filename); _tempCreativeTeam.Add(newcreativeteam.Id); var eventrepository = new EventRepository(_connectionString); var teamEvent = eventrepository.CreateEvent(newEvent, file.Bytes, file.Filename, newcreativeteam.Id); _tempEvent.Add(teamEvent.Id); teamEvent.Description = "Big concert!!!!!!!!!!!!!!!!!"; var result = eventrepository.UpdateEvent(teamEvent); Assert.AreEqual(teamEvent.Description, result.Description); }
private void Add() { Event e = new Event { EventType = _entity.EventType, EventName = _entity.EventName, EventDescription = _entity.EventDescription, EventOrg = _entity.EventOrg, EventLocation = _entity.EventLocation, EventDate = _entity.EventDate, EventPrice = _entity.EventPrice }; _eventRepository.CreateEvent(e); }
public void ShoulGetUserUpcomingEvents() { var user = new User { Age = 18, City = "Москва", Email = "*****@*****.**", Name = "Марина", Surname = "Купцова", Password = "******", }; var creativeteam = new CreativeTeam { About = "test", Email = "*****@*****.**", Genre = "rock/hardcore/post-punk", Name = "testband", Password = "******", Rating = 3.2, SubscribersCount = 0 }; var photo = new File { Bytes = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, FileExtension = ".jpeg", Filename = "test.jpeg" }; var newEvent = new Event { DateAndTime = DateTime.Now, Description = "Big concert on the street of your city!", ParticipantCount = 0, Place = "Saint-Petersburg, Russia1" }; var newEvent2 = new Event { DateAndTime = DateTime.Now, Description = "Big concert!!!!!", ParticipantCount = 0, Place = "Saint-Petersburg, Russia1" }; var file = new File { Bytes = new byte[] { 1, 12, 123, 13 }, FileExtension = ".jpg", Filename = "fotka" }; var userRepository = new UserRepository(_connectionString); var eventRepository = new EventRepository(_connectionString); var creativeteamRepository = new CreativeTeamRepository(_connectionString); var newUser = userRepository.CreateUser(user, file); _tempUsers.Add(newUser.Id); var newCreativeteam = creativeteamRepository.CreateCreativeTeam(creativeteam, photo.Bytes, photo.Filename); _tempCreativeTeam.Add(newCreativeteam.Id); var teamEvent = eventRepository.CreateEvent(newEvent, photo.Bytes, photo.Filename, newCreativeteam.Id); var teamEvent2 = eventRepository.CreateEvent(newEvent2, photo.Bytes, photo.Filename, newCreativeteam.Id); _tempEvent.Add(teamEvent.Id); _tempEvent.Add(teamEvent2.Id); userRepository.GoToEvent(newUser.Id, teamEvent2.Id); var usersEvents = new List <Event>(); usersEvents = eventRepository.GetUserUpcomingEvents(newUser); var result = usersEvents.Find(x => x.Id == teamEvent2.Id); Assert.AreEqual(teamEvent2.Description, result.Description); }