public async Task<IHttpActionResult> Create(CreateSongDTO model) { if (!ModelState.IsValid) { return BadRequest(ModelState); } SongRepository.Insert(SongMapper.Map(model)); await SongRepository.SaveAsync(); return Ok(); }
public static Song Map(CreateSongDTO input) { return new Song { Title = input.Title, CoverUrl = input.CoverUrl, FileUrl = input.FileUrl, DateReleased = DateTime.Now, AuthorId = input.AuthorId }; }