public static ProcedureCategory MapToEntity(this ProcedureCategoryDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            return(new ProcedureCategory
            {
                Name = dto.Name,
                Description = dto.Description
            });
        }
Ejemplo n.º 2
0
        public static ProcedureCategoryViewModel MapToViewModel(this ProcedureCategoryDto dto)
        {
            if (dto == null)
            {
                return(null);
            }

            return(new ProcedureCategoryViewModel
            {
                Id = dto.Id,
                Name = dto.Name,
                Description = dto.Description
            });
        }
        public async Task Edit(ProcedureCategoryDto dto)
        {
            var entity = await _procedureCategoryRepository.GetById(dto.Id);

            if (entity == null)
            {
                return;
            }

            entity.Name        = dto.Name;
            entity.Description = dto.Description;

            await _procedureCategoryRepository.Update(entity);
        }
 public async Task Add(ProcedureCategoryDto dto)
 {
     var entity = dto.MapToEntity();
     await _procedureCategoryRepository.Add(entity);
 }