Example #1
0
        public async Task <IActionResult> FileUpload(ICollection <IFormFile> files)
        {
            foreach (var file in files)
            {
                if (file.Length > 0)
                {
                    using (var ms = new MemoryStream())
                    {
                        var fileName = file.FileName;
                        file.CopyTo(ms);
                        var fileBytes = ms.ToArray();

                        var userName = User.Identity.Name;
                        var user     = await _userRepository.GetByUserName(userName);

                        var presentation = new Presentation()
                        {
                            User = user, File = fileBytes, Name = fileName
                        };
                        await _presentationRepository.Create(presentation);
                    }
                }
            }
            return(View("Index"));
        }
Example #2
0
 private void CreateForTick(SimulationView simulationView, int tick) =>
 _presentationRepository.Create(new Presentation.Sector
 {
     SimulationId          = simulationView.Simulation.Id,
     Tick                  = tick,
     StarSystems           = GetStarSystems(simulationView),
     StarSystemConnections = GetStarSystemConnections(simulationView.StarSystems)
 });
        public async Task Execute(PresentationDto dto)
        {
            var conversationId = await conversations.CreateConversation(dto.Name, dto.CreatedBy);

            dto.ConversationId = conversationId;

            await presentationRepository.Create(dto);
        }
Example #4
0
 public IActionResult Create([Bind("Id,Name,StartDateTime,EndDateTime,Description,SpeakerId")] Presentation presentation)
 {
     if (ModelState.IsValid)
     {
         _presentationRepository.Create(presentation);
         return(RedirectToAction(nameof(Index)));
     }
     ViewData["SpeakerId"] = new SelectList(_speakerRepository.GetAllSpeakers(), "Id", "Id", presentation?.SpeakerId);
     return(View(presentation));
 }
Example #5
0
        public async Task <IActionResult> Create([Bind("Id,File")] Presentation presentation)
        {
            if (ModelState.IsValid)
            {
                await _presentationRepository.Create(presentation);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(presentation));
        }