public void Add(SchoolSubTypeDto schoolSubTypeDto) { var schoolSubType = new SchoolSubType() { Name = schoolSubTypeDto.Name, SchoolTypeId = schoolSubTypeDto.SchoolTypeId }; _schoolSubTypeRepository.Add(schoolSubType); }
public void Update(short Id, SchoolSubTypeDto model) { var schoolSubType = _schoolSubTypeRepository.GetById(Id); if (schoolSubType != null) { schoolSubType.Name = model.Name; _schoolSubTypeRepository.Update(schoolSubType); } }
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); }
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()); }