public ActionResult EditTrack(EditTrack model)
        {
            /*TODO
             * jak wracamy z wyboru nowego artysty to żeby wrócić do miejsca edycjia, a nie listy od nowa, bo w sumie wtedy co klikneliśmy to sobie tak zniknęło i trochę bez sensu :/ */
            int NewArtist = 0;

            if (Request.QueryString["TrackId"] != null)
            {
                model.TrackId = (int)double.Parse(Request.QueryString["TrackId"]);
            }
            if (Request.QueryString["ArtistId"] != null)
            {
                NewArtist = (int)double.Parse(Request.QueryString["ArtistId"]);
            }

            if (TempData["TrackInEdit"] != null)
            {
                // model.TrackId = (int)TempData["TrackInEdit"];
            }

            /*
             *
             *
             * http://localhost:58803/Track/EditTrack?TrackId=2137&ArtistId=1488
             * Tak powinien wygladać zawsze link do  edycji track,a bedzie chyabtak łatwiej
             */

            if (model.TrackId != 0)
            {
                model = DetailTrackDB.DetailTracktoEdit(model.TrackId);

                if (model.ArtistId == 0)
                {
                    var Artist = DetailArtistDB.DetailFromId(0);
                    model.Firstname = Artist.Firstname;
                    model.Lastname  = Artist.Lastname;
                }
                Cookies.RememberDateFromModel(model.ReleaseDate);
                Cookies.Today();
                TempData["TrackInEdit"] = model.TrackId;
                return(View(model));
            }
            else
            {
                //model = DetailTrackDB.DetailTracktoEdit(13);
                //  return View(model);
                return(RedirectToAction("ListTrack"));
            }
        }
Beispiel #2
0
 public ActionResult EditArtist()
 {
     if (Url.RequestContext.RouteData.Values["id"] != null)
     {
         int          ArtistId = (int)Double.Parse(Url.RequestContext.RouteData.Values["id"].ToString());
         DetailArtist model    = DetailArtistDB.DetailFromId(ArtistId);
         Cookies.CreateDay(model.Birthdate);
         Cookies.Today();
         return(View(model));
     }
     else
     {
         return(RedirectToAction("ListArtist"));
     }
 }
Beispiel #3
0
        // GET: Artysta/Details/5
        public ActionResult DetailsArtist(DetailArtist model)
        {
            if (Url.RequestContext.RouteData.Values["id"] != null)
            {
                int ArtistId = (int)Double.Parse(Url.RequestContext.RouteData.Values["id"].ToString());
                model = DetailArtistDB.DetailFromId(ArtistId);
            }
            else
            {
                return(RedirectToAction("ListArtist"));
            }
            var dupa = model.Birthdate.ToString();
            var ad   = dupa;

            /*
             * Po create
             * "31.12.2020 00:00:00 +01:00"
             *
             */
            return(View(model));
        }