public static void UpdateUserAudio(this UserAudio userAudio, UserAudioViewModel userAudioVM) { userAudio.Id = userAudioVM.Id; userAudio.UserId = userAudioVM.UserId; userAudio.AudioTitle = userAudioVM.AudioTitle; userAudio.Path = userAudioVM.Path; userAudio.CreatedDate = userAudioVM.CreatedDate; userAudio.Text = userAudioVM.Text; }
public ActionResult Edit(UserAudioViewModel userAudioViewModel) { UserAudio userAudioModel = new UserAudio(); userAudioModel.UpdateUserAudio(userAudioViewModel); _userAudioService.Update(userAudioModel); _userAudioService.Save(); return(RedirectToAction("Index")); }
public ActionResult Create(UserAudioViewModel userAudioViewModel) { if (ModelState.IsValid) { UserAudio userAudioModel = new UserAudio(); userAudioModel.UpdateUserAudio(userAudioViewModel); userAudioModel.CreatedDate = DateTime.Now; userAudioModel.UserId = User.Identity.GetUserId(); _userAudioService.Add(userAudioModel); _userAudioService.Save(); return(RedirectToAction("Index")); } return(View()); }