public ActionResult Edit(TrackBase track) { var previousRecord = _repository.GetTrack(track.ConferenceId, track.TrackId); if (previousRecord == null) { _repository.AddTrack(ref track, User.UserID); } else { track.CreatedOnDate = previousRecord.CreatedOnDate; track.CreatedByUserID = previousRecord.CreatedByUserID; _repository.UpdateTrack(track, User.UserID); } return(ReturnRoute(track.ConferenceId, View("View", _repository.GetTrack(track.ConferenceId, track.TrackId)))); }
public IActionResult AddTrack([FromForm] TrackForCreationDto track) { if (ModelState.IsValid) { if (track == null) { return(BadRequest()); } var trackEntity = Mapper.Map <Track_Members>(track); var artistId = (from a in _con.Artists where a.ApplicationUserId == stringId select a.Id).First(); trackEntity.ArtistId = artistId; trackEntity.TrackPathUrl = Upload(artistId); _trackRepo.AddTrack(trackEntity); if (!_trackRepo.Save()) { ViewBag.Notification("No User Created"); } } return(View()); }