public static MemberServiceModel ToServiceModel(this MemberDto memberDto)
        {
            var serviceModel = new MemberServiceModel();

            serviceModel.InjectFrom(memberDto);
            return(serviceModel);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Get(int id)
        {
            MemberServiceModel serviceModel = await memberService.GetMemberByIdAsync(id);

            var dto = new MemberDto(serviceModel);

            return(Ok(dto));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Put(int id, [FromBody] MemberDto dto)
        {
            MemberServiceModel found = await memberService.GetMemberByIdAsync(id);

            if (found == null)
            {
                return(NotFound());
            }

            await memberService.SaveMemberAsync(dto.ToServiceModel());

            return(NoContent());
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Delete(int id)
        {
            MemberServiceModel found = await memberService.GetMemberByIdAsync(id);

            if (found == null)
            {
                return(NotFound());
            }

            await memberService.DeleteMemberAsync(id);

            return(NoContent());
        }
Exemplo n.º 5
0
 public MemberDto(MemberServiceModel memberServiceModel)
 {
     this.InjectFrom(memberServiceModel);
 }
Exemplo n.º 6
0
 public MemberListDto(MemberServiceModel memberServiceModel)
 {
     this.InjectFrom(memberServiceModel);
     FullName = memberServiceModel.FirstName + " " + memberServiceModel.LastName;
     DojoName = memberServiceModel.DojoName;
 }