示例#1
0
        // PUT api/Performers/5
        public PerformerDto Put([FromBody] PerformerDto performer)
        {
            var updatedPerformer = performer.ConvertFromDto();

            PerformerService.Update(updatedPerformer);
            return(updatedPerformer.ConvertToDto());
        }
示例#2
0
        // POST api/Performers
        public PerformerDto Post([FromBody] PerformerDto performer)
        {
            var newPerformer = performer.ConvertFromDto();

            PerformerService.Add(newPerformer);
            return(newPerformer.ConvertToDto());
        }
示例#3
0
        public PerformerDto GetShowContests(int id, [FromBody] PerformerDto performer)
        {
            var contestantId = id;
            var newPerformer = performer.ConvertFromDto();

            PerformerService.AddContestantPerformer(contestantId, newPerformer);
            return(newPerformer.ConvertToDto());
        }
示例#4
0
        private PerformerDto MapPerformerToDto(Performer performer)
        {
            PerformerDto performerDto = new PerformerDto();

            performerDto.Id            = performer.Id;
            performerDto.Name          = performer.Name;
            performerDto.ImageUrl      = performer.ImageUrl;
            performerDto.TourName      = performer.TourName;
            performerDto.IsActive      = performer.IsActive;
            performerDto.PerformerType = performer.PerformerType;
            if (performer.PerformerType == PerformerType.Musician)
            {
                performerDto.Genre = performer.Genre;
            }
            else
            {
                performerDto.Topic = performer.Topic;
            }

            return(performerDto);
        }
示例#5
0
 // DELETE api/Performers/5
 public void Delete([FromBody] PerformerDto performer)
 {
     PerformerService.Delete(performer.ConvertFromDto());
 }
示例#6
0
 public static Performer ConvertFromDto(this PerformerDto performerDto)
 {
     return(new Performer(performerDto.Id, ConvertFromDto(performerDto.Division), ConvertFromDto(performerDto.Name), ConvertFromDto(performerDto.Affiliation)));
 }