public async Task <ActionResult <ChannelDTO> > Update(Guid channelId, [FromBody] UpdateChannelDTO model) { // Get the selected channel var channel = channelRepository.GetById(channelId); // Update the channel model with the information received from our DTO. channel.UpdateFromUpdateChannelDTO(model); // Save changes made to the channel model. channelRepository.SaveChanges(); return(NoContent()); }
public void UpdateFromUpdateChannelDTO(UpdateChannelDTO model) { this.Name = model.Name; // Automatically update the modified time to reflect changes. this.Modified = DateTime.Now; }