public async Task UpdateAsync(EducationMajorModel model)
        {
            var major = await _repository.GetByIdAsync(model.MajorId);

            major.DegreeId      = model.DegreeId;
            major.MarjorName    = model.MarjorName;
            major.MajorNameThai = model.MajorNameThai;

            await _repository.UpdateAsync(major);
        }
        public async Task AddAsync(EducationMajorModel model)
        {
            var major = new MasterEducationMajor
            {
                DegreeId      = model.DegreeId,
                MarjorName    = model.MarjorName,
                MajorNameThai = model.MajorNameThai
            };

            await _repository.AddAsync(major);
        }
示例#3
0
        public async Task <IActionResult> Create(MajorEditViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var degree = new EducationMajorModel
            {
                DegreeId      = model.DegreeId,
                MarjorName    = model.MarjorName,
                MajorNameThai = model.MajorNameThai
            };

            await _majorService.AddAsync(degree);

            return(RedirectToAction(nameof(Index)));
        }