Example #1
0
        public ActionResult <InsertClassResponse> Insert(IFormFile file)
        {
            InsertClassRequest  request  = new InsertClassRequest(file.OpenReadStream());
            InsertClassResponse response = this._insertClass.Process(request);

            if (!response.Success)
            {
                return(BadRequest(response));
            }

            return(Ok(response));
        }
Example #2
0
        public void Execute(ClassInputDto classInputDto, InsertClassResponse response, int lineNumber)
        {
            string lineWithError = $"Line {lineNumber} =>";

            if (classInputDto == null)
            {
                response.AddError("001", $"Line {lineNumber} can't be null.");

                return;
            }

            this._parametersValidator.ClassId(classInputDto.Id, response, lineWithError);

            this._parametersValidator.Teacher(classInputDto.Teacher, response, lineWithError);

            this._parametersValidator.Course(classInputDto.Course, response, lineWithError);

            this._parametersValidator.Shift(classInputDto.Shift, response, lineWithError);

            this._parametersValidator.Date(classInputDto.StartDate, classInputDto.EndDate, response, lineWithError);

            this._parametersValidator.Time(classInputDto.StartTime, classInputDto.EndTime, response, lineWithError);
        }