public IActionResult UploadTalkScheduleFile(UploadTalkScheduleFile model)
        {
            if (model.TalkScheduleFile == null)
            {
                return(View());
            }
            var talkDetails = string.Empty;

            using (var reader = new StreamReader(model.TalkScheduleFile.OpenReadStream()))
            {
                talkDetails = reader.ReadToEnd();
            }

            string [] fileContents = talkDetails.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

            var scheduledTracks = talkScheduler.ScheduleTalks(fileContents);

            var formatedScheduleOutput = trackInfomationOutputBuilder.BuildTrackInfoOutput(scheduledTracks);

            return(View(nameof(TalkScheduleResult), formatedScheduleOutput));
        }
예제 #2
0
        public IEnumerable <string> UploadScheduleFile()
        {
            var file = Request.Form.Files[0];

            if (file.Length < 0)
            {
                return(new List <string>());
            }

            var talkDetails = string.Empty;

            using (var reader = new StreamReader(file.OpenReadStream()))
            {
                talkDetails = reader.ReadToEnd();
            }

            string[] fileContents = talkDetails.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

            var scheduledTracks = talkScheduler.ScheduleTalks(fileContents);

            var formatedScheduleOutput = trackInfomationOutputBuilder.BuildTrackInfoOutput(scheduledTracks);

            return(formatedScheduleOutput);
        }