private async Task SubmitSpecializationForm(object arg)
        {
            await _specializationService.Create(SpecializationCode, SpecializationName);

            ResetForm();
            SpecializationAdded?.Invoke();
        }
Exemple #2
0
        public async Task <IActionResult> AddNewSpecialization(AddSpecializationModel model)
        {
            SpecializationDTO newItem = new SpecializationDTO()
            {
                nameSpecialization = model.nameSpecialization,
                Speciality         = model.nameSpeciality,
                nameCathedra       = model.nameCathedra
            };

            await specialization.Create(newItem);

            return(RedirectToAction("GetSpecialization", "EducationalDepartment"));
        }
 public ActionResult <SpecializationDto> Create([FromHeader] Guid token, [FromBody] SpecializationDto specialization)
 {
     try
     {
         ValidateToken(token);
         return(Ok(_specializationService.Create(specialization)));
     }
     catch (AuthenticationException)
     {
         return(Unauthorized());
     }
     catch (ArgumentException e)
     {
         return(NotFound(e.Message));
     }
 }
Exemple #4
0
        public ActionResult CreateSpecialization(СreateSpecializationViewModel specialization)
        {
            if (ModelState.IsValid)
            {
                var config = new MapperConfiguration(cfg =>
                {
                    cfg.CreateMap <СreateSpecializationViewModel, SpecializationDto>();
                });
                var mapper = config.CreateMapper();
                _specializationService.Create(mapper.Map <СreateSpecializationViewModel, SpecializationDto>(specialization));

                return(RedirectToAction("Specializations", "Home"));
            }
            ModelState.AddModelError("", "Something failed");
            return(View());
        }
Exemple #5
0
 public int Save() => _specializationService.Create(this);