コード例 #1
0
        /// <summary>
        /// Deletes the track with the specified <paramref name="id"/> from the system.
        /// </summary>
        /// <param name="id">
        /// The track id.
        /// </param>
        /// <returns>
        /// The view which generates page for deleting tracks in case if <paramref name="id"/> was specified;
        /// otherwise redirects to the list of tracks.
        /// </returns>
        public ActionResult Delete(int?id)
        {
            if (id == null || id <= 0)
            {
                return(RedirectToAction("List", "Tracks", new { area = "Content" }));
            }

            var trackService = ServiceFactory.GetTrackService();
            var track        = ManagementMapper.GetTrackManagementViewModel(trackService.GetTrackDetails(id.Value, CurrentUserCurrency.Code, CurrentUser.PriceLevelId));

            if (track == null)
            {
                return(HttpNotFound($"Трек с id = {id} не найден"));
            }

            return(View(track));
        }
コード例 #2
0
        /// <summary>
        /// </summary>
        /// <returns>
        /// </returns>
        public virtual ActionResult Edit(int id = 0)
        {
            if (id <= 0)
            {
                return(RedirectToAction("List", "Tracks", new { area = "Content" }));
            }

            var trackService             = ServiceFactory.GetTrackService();
            var trackManagementViewModel = ManagementMapper.GetTrackManagementViewModel(trackService.GetTrackDetails(id, CurrentUserCurrency.Code, CurrentUser.PriceLevelId));

            if (trackManagementViewModel == null)
            {
                return(HttpNotFound($"Трек с id = {id} не найден"));
            }

            trackManagementViewModel.Genres = GetGenres();

            return(this.View(trackManagementViewModel));
        }