示例#1
0
        public void Add(SchoolSubTypeDto schoolSubTypeDto)
        {
            var schoolSubType = new SchoolSubType()
            {
                Name         = schoolSubTypeDto.Name,
                SchoolTypeId = schoolSubTypeDto.SchoolTypeId
            };

            _schoolSubTypeRepository.Add(schoolSubType);
        }
示例#2
0
        public void Update(short Id, SchoolSubTypeDto model)
        {
            var schoolSubType = _schoolSubTypeRepository.GetById(Id);

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

                _schoolSubTypeRepository.Update(schoolSubType);
            }
        }
示例#3
0
        public static SchoolSubType Mapper(this SchoolSubTypeDto dto)
        {
            var model = new SchoolSubType();

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

            return(model);
        }
示例#4
0
        public static SchoolSubTypeDto Mapper(this SchoolSubType schoolSubType)
        {
            var dto = new SchoolSubTypeDto();

            if (schoolSubType != null)
            {
                dto.Id             = schoolSubType.Id;
                dto.Name           = schoolSubType.Name;
                dto.SchoolTypeId   = schoolSubType.SchoolType.Id;
                dto.SchoolTypeName = schoolSubType.Name;
            }

            return(dto);
        }
        public IActionResult Put(short Id, [FromBody] SchoolSubTypeDto value)
        {
            _schoolSubTypeService.Update(Id, value);

            return(Ok());
        }
        public IActionResult Post([FromBody] SchoolSubTypeDto value)
        {
            _schoolSubTypeService.Add(value);

            return(Ok());
        }