private async Task SubmitSpecializationForm(object arg) { await _specializationService.Create(SpecializationCode, SpecializationName); ResetForm(); SpecializationAdded?.Invoke(); }
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)); } }
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()); }
public int Save() => _specializationService.Create(this);