예제 #1
0
        public ActionResult SaveAanvraag(RequestViewModel viewModel)
        {
            var requestId = int.Parse(viewModel.RequestId);

            if (_studentFacade.IsRequestFromStudent(viewModel.FileId, requestId, User.Identity.Name))
            {
                Content("Don't cheat!");
            }

            var request = new Request
            {
                Id     = requestId,
                FileId = viewModel.FileId
            };;

            if (viewModel.Evidence != null)
            {
                viewModel.Evidence = viewModel.Evidence.Distinct().ToArray();
                request.Evidence   = viewModel.Evidence.Select(evidenceId => new Evidence
                {
                    Id = evidenceId
                }).AsQueryable();
            }
            if (viewModel.Educations != null)
            {
                viewModel.Educations = viewModel.Educations.Distinct().ToArray();
                request.Educations   = viewModel.Educations.Select(educationId => new PrevEducation
                {
                    Id = educationId
                }).AsQueryable();
            }


            return(Content(!_studentFacade.SyncRequestInFile(request) ? "Don't cheat!" : "Saved!"));
        }