// PUT api/Performers/5 public PerformerDto Put([FromBody] PerformerDto performer) { var updatedPerformer = performer.ConvertFromDto(); PerformerService.Update(updatedPerformer); return(updatedPerformer.ConvertToDto()); }
// POST api/Performers public PerformerDto Post([FromBody] PerformerDto performer) { var newPerformer = performer.ConvertFromDto(); PerformerService.Add(newPerformer); return(newPerformer.ConvertToDto()); }
public PerformerDto GetShowContests(int id, [FromBody] PerformerDto performer) { var contestantId = id; var newPerformer = performer.ConvertFromDto(); PerformerService.AddContestantPerformer(contestantId, newPerformer); return(newPerformer.ConvertToDto()); }
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); }
// DELETE api/Performers/5 public void Delete([FromBody] PerformerDto performer) { PerformerService.Delete(performer.ConvertFromDto()); }
public static Performer ConvertFromDto(this PerformerDto performerDto) { return(new Performer(performerDto.Id, ConvertFromDto(performerDto.Division), ConvertFromDto(performerDto.Name), ConvertFromDto(performerDto.Affiliation))); }