Beispiel #1
0
        public void Update(short Id, EducationLevelDto model)
        {
            var educationLevel = _educationLevelRepository.GetById(Id);

            if (educationLevel != null)
            {
                educationLevel.Name = model.Name;

                _educationLevelRepository.Update(educationLevel);
            }
        }
Beispiel #2
0
        public static EducationLevelDto Mapper(this EducationLevel educationLevel)
        {
            var dto = new EducationLevelDto();

            if (educationLevel != null)
            {
                dto.Id   = educationLevel.Id;
                dto.Name = educationLevel.Name;
            }

            return(dto);
        }
Beispiel #3
0
        public async Task <PartialViewResult> CreateOrEditModal(int?id)
        {
            var output = new EducationLevelDto();

            if (id != null)
            {
                output = _service.GetEducationLevel(new GetEducationLevelInput {
                    EducationLevelId = id.Value
                });
            }
            var viewModel = new CreateOrEditEducationalLevelModel(output);

            return(PartialView("_CreateOrEditModal", viewModel));
        }
 public async Task <ActionResponse <EducationLevelDto> > Insert(EducationLevelDto entityDto)
 {
     try
     {
         var entityToAdd = mapper.Map <EducationLevelDto, EducationLevel>(entityDto);
         unitOfWork.GetGenericRepository <EducationLevel>().Add(entityToAdd);
         unitOfWork.Save();
         return(await ActionResponse <EducationLevelDto>
                .ReturnSuccess(mapper.Map <EducationLevel, EducationLevelDto>(entityToAdd)));
     }
     catch (Exception)
     {
         return(await ActionResponse <EducationLevelDto> .ReturnError("Greška prilikom unosa razine obrazovanja."));
     }
 }
        public IActionResult Put(short id, [FromBody] EducationLevelDto value)
        {
            _educationLevelService.Update(id, value);

            return(Ok());
        }
 public CreateOrEditEducationalLevelModel(EducationLevelDto level)
 {
     EducationLevel = level;
 }
 public async Task <ActionResponse <EducationLevelDto> > Update([FromBody] EducationLevelDto request)
 {
     return(await educationLevelService.Update(request));
 }