Пример #1
0
        public async Task UpdateSectionType(SectionTypeDto pSectionType)
        {
            SectionTypeEntity lSectionTypeEntity = await this._sectionTypeRepository.GetById(pSectionType.Id);

            Mapping.Mapper.Map <SectionTypeDto, SectionTypeEntity>(pSectionType, lSectionTypeEntity);
            await this._sectionTypeRepository.Update(lSectionTypeEntity);
        }
Пример #2
0
        public async Task <IActionResult> Edit(int id)
        {
            SectionTypeDto lSectionTypeDto = await this._referenceServices.GetSectionTypeById(id);

            var lViewModelToEdit = Mapping.Mapper.Map <SectionTypeViewModel>(lSectionTypeDto);

            //this._referenceServices.
            return(View(lViewModelToEdit));
        }
Пример #3
0
        public async Task <IActionResult> Edit(SectionTypeViewModel pViewModelToUpdate)
        {
            if (!ModelState.IsValid)
            {
                return(View(pViewModelToUpdate));
            }

            // map to Dto
            SectionTypeDto lSectionTypeDto = Mapping.Mapper.Map <SectionTypeDto>(pViewModelToUpdate);

            await this._referenceServices.UpdateSectionType(lSectionTypeDto);

            return(RedirectToAction("Index", new { successMessage = "SectionType successfully updated" }));
        }