예제 #1
0
        /// <summary>
        /// Create a new artist
        /// </summary>
        /// <param name="request"><see cref="CreateArtist"/> request</param>
        /// <returns><see cref="ArtistResponse"/> Response</returns>
        public ArtistResponse Post(CreateArtist request)
        {
            this.Logger.Info("Create a new artist");

            var newArtist = this.ArtistRepository.Add(this.ArtistMapper.ToArtist(request));
            var response = this.ArtistMapper.ToArtistResponse(newArtist);
            Response.AddHeader("Location", Request.AbsoluteUri + "/" + newArtist.Id);
            Response.StatusCode = (int)HttpStatusCode.Created;

            return response;
        }
예제 #2
0
 /// <summary>
 /// Mapping for Create artist request
 /// </summary>
 /// <param name="request">Artist request</param>
 /// <returns>An Artist</returns>
 public Artist ToArtist(CreateArtist request)
 {
     LogManager.GetLogger("").Info("Mapping for Create artist request");
     return Mapper.Map<Artist>(request);
 }