Exemplo n.º 1
0
        public async Task <ActionResult> Edit(int userId)
        {
            string response = await clsFanRequests.GetFanBands(userId);

            //Hubo error
            if (!ErrorParser.parse(response).Equals(""))
            {
                ViewBag.Message = "F**k my life2...";
            }
            FanProfileViewModel profile = DataParser.parseFanBands(response);

            string response2 = await clsRegisterRequests.GetRegisterFanForm();

            string ParsedMessage = ErrorParser.parse(response2);

            profile.EditForm = DataParser.parseFanForm(response2);

            string response3 = await clsFanRequests.GetFanInfo(userId);

            profile.Info = DataParser.parseFanInfo(response3);

            try {
                profile.Id       = Int32.Parse(Session["Id"].ToString());
                profile.Username = Session["Username"].ToString();
                profile.Name     = Session["Name"].ToString();
            }
            catch (NullReferenceException)
            {
                //Not logged in
                ViewBag.Message = "Please log in first";
                return(View("~/Views/Login/Index.cshtml"));
            }
            return(View(profile));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> Index(int userId)
        {
            if (Sessions.isAuthenticated(Request, Session))
            {
                int sessionRol = Int32.Parse(Session["rol"].ToString());
                if (!Sessions.isFan(sessionRol))
                {
                    return(View("~/Views/Login/Index.cshtml"));
                }
            }
            //[Bandas,Posts]
            List <string> response = await clsFanRequests.GetFanProfile(userId);

            //Hubo error
            if (!ErrorParser.parse(response[0]).Equals("") || !ErrorParser.parse(response[1]).Equals(""))
            {
                ViewBag.Message = "F**k my life...";
            }

            FanProfileViewModel profile = DataParser.parseFanProfile(response);

            try
            {
                profile.Id       = Int32.Parse(Session["Id"].ToString());
                profile.Username = Session["Username"].ToString();
                profile.Name     = Session["Name"].ToString();
            }
            catch (NullReferenceException)
            {
                //Not logged in
                ViewBag.Message = "Please log in first";
                return(View("~/Views/Login/Index.cshtml"));
            }
            return(View(profile));
        }
Exemplo n.º 3
0
        public static FanProfileViewModel parseFanBands(string json)
        {
            FanProfileViewModel profile = new FanProfileViewModel();

            profile.Bands = parseBands(json);
            return(profile);
        }
Exemplo n.º 4
0
        public static FanProfileViewModel parseFanProfile(List <string> json)
        {
            FanProfileViewModel profile = new FanProfileViewModel();

            profile.Bands = parseBands(json[0]);
            profile.Posts = parsePosts(json[1]);

            return(profile);
        }
Exemplo n.º 5
0
        // GET: Fans/Albums
        public async System.Threading.Tasks.Task <ActionResult> Index(int userId, int bandId, int id)
        {
            System.Diagnostics.Debug.WriteLine("check band from " + userId + " of band " + bandId + " with album " + id);


            // try { } catch ()
            if (Sessions.isAuthenticated(Request, Session))
            {
                int sessionRol = Int32.Parse(Session["rol"].ToString());
                if (!Sessions.isFan(sessionRol))
                {
                    return(View("~/Views/Login/Index.cshtml"));
                }
            }
            //[Bandas,Posts]
            // string response = await Fans.Requests.clsBandRequests.GetBandInfo(bandId);
            string response2 = await Bands.Requests.clsBandRequests.getBandAlbums(bandId);

            string response3 = await Bands.Requests.clsAlbumRequests.GetAlbumInfo(bandId, id);

            string response4 = await Bands.Requests.clsBandRequests.GetBandInfo(bandId);

            System.Diagnostics.Debug.WriteLine(response4);
            //Hubo error

            /* if (!ErrorParser.parse(response).Equals(""))
             * {
             *   ViewBag.Message = "F**k my life...";
             * }*/

            //clsInfoBand infoBand = DataParser.parseBandInfo(response);

            FanProfileViewModel  profile     = new FanProfileViewModel();
            BandProfileViewModel BandProfile = new BandProfileViewModel();

            BandProfile.Id      = bandId;
            profile.BandProfile = BandProfile;


            profile.Id       = Int32.Parse(Session["Id"].ToString());
            profile.Username = Session["Username"].ToString();
            profile.Name     = Session["Name"].ToString();
            // profile.BandInfo = infoBand;
            profile.BandProfile.Albums = DataParser.parseAlbums(response2);



            profile.BandProfile.Disk = DataParser.parseDisk(response3);
            profile.BandProfile.Info = DataParser.parseBandInfo(response4);
            return(View(profile));
        }
Exemplo n.º 6
0
        public async Task <ActionResult> Search(string name, string country, string genre)
        {
            string response = await clsFanRequests.GetFanBands(Int32.Parse(Session["Id"].ToString()));

            clsSearch searchParams = new clsSearch();

            searchParams.Name    = name;
            searchParams.Genre   = genre;
            searchParams.Country = country;

            string response2 = await clsUserRequests.Search(searchParams);

            //Hubo error
            if (!ErrorParser.parse(response).Equals(""))
            {
                ViewBag.Message = "F**k my life2...";
            }
            FanProfileViewModel profile = DataParser.parseFanBands(response);

            profile.SearchResults = DataParser.parseBands(response2);

            System.Diagnostics.Debug.WriteLine("search " + profile.SearchResults.Count);

            try {
                profile.Id       = Int32.Parse(Session["Id"].ToString());
                profile.Username = Session["Username"].ToString();
                profile.Name     = Session["Name"].ToString();
            }
            catch (NullReferenceException)
            {
                //Not logged in
                ViewBag.Message = "Please log in first";
                return(View("~/Views/Login/Index.cshtml"));
            }
            //return View(profile);


            //TempData["profile"] = profile;
            //return RedirectToAction("Search", "Fans", new { area = "Fans", userId = Session["id"] });
            return(View(profile));
        }