public async Task <ActionResult> NewSong(int albumId, string Name, string Duration, bool Live, bool LimitedEdition, string UrlVideo) { /* System.Diagnostics.Debug.WriteLine(albumId); * System.Diagnostics.Debug.WriteLine(Name); * System.Diagnostics.Debug.WriteLine(Live); * System.Diagnostics.Debug.WriteLine(Duration); * System.Diagnostics.Debug.WriteLine(LimitedEdition); * System.Diagnostics.Debug.WriteLine(UrlVideo);*/ clsSong form = new clsSong(); form.Duration = Duration; form.Link = UrlVideo; form.Name = Name; form.LimitedEdition = LimitedEdition; form.Type = Live; string response = await clsAlbumRequests.PostSongForm(form, Int32.Parse(Session["Id"].ToString()), albumId); if (!ErrorParser.parse(response).Equals("")) { ViewBag.Message = "F**k my life..."; } return(Json(form)); }
// GET: Bands/Albums public async Task <ActionResult> Index(int userId, int Id) { //System.Diagnostics.Debug.WriteLine("check band from " + userId + " with album " + Id); string response = await clsBandRequests.getBandAlbums(userId); //System.Diagnostics.Debug.WriteLine("Soy yo 1: " + response); string response2 = await clsAlbumRequests.GetAlbumInfo(userId, Id); //System.Diagnostics.Debug.WriteLine("Soy yo: " + response2); //Hubo error if (!ErrorParser.parse(response).Equals("")) { ViewBag.Message = "F**k my life..."; } BandProfileViewModel profile = new BandProfileViewModel(); profile.Id = Int32.Parse(Session["Id"].ToString()); profile.Username = Session["Username"].ToString(); profile.Name = Session["Name"].ToString(); profile.Albums = DataParser.parseAlbums(response); profile.Disk = DataParser.parseDisk(response2); return(View(profile)); }
// GET: Bands/News public async Task <ActionResult> Index(int userId, int id) { System.Diagnostics.Debug.WriteLine("check band from " + userId + " with new " + id); string response = await clsBandRequests.getBandAlbums(userId); string response2 = await clsNewRequests.GetNew(userId, id); System.Diagnostics.Debug.WriteLine("antes de parsear " + response2); if (!ErrorParser.parse(response2).Equals("")) { ViewBag.Message = "Couldn´t get the news correctly"; } BandProfileViewModel profile = new BandProfileViewModel(); profile.Id = Int32.Parse(Session["Id"].ToString()); profile.Username = Session["Username"].ToString(); profile.Name = Session["Name"].ToString(); profile.Albums = DataParser.parseAlbums(response); profile.New = DataParser.parseNew(response2); return(View(profile)); }
public async Task <ActionResult> NewNoticia(string NewTitle, string inputContent) { System.Diagnostics.Debug.WriteLine(NewTitle); System.Diagnostics.Debug.WriteLine(inputContent); clsNew form = new clsNew(); form.Title = NewTitle; form.Content = inputContent; string response = await clsNewRequests.PostNewForm(form, Int32.Parse(Session["Id"].ToString())); if (!ErrorParser.parse(response).Equals("")) { ViewBag.Message = "Couldn´t get the news correctly"; } System.Diagnostics.Debug.WriteLine(response); int Id = DataParser.parseNewForm(response); System.Diagnostics.Debug.WriteLine("Got id: " + Id); return(Json(new { redirectUrl = Url.Action("Index", "News", new { userId = Int32.Parse(Session["Id"].ToString()), id = Id }), isRedirect = true })); }
public async Task <ActionResult> GetBandStats(int fanId, int bandId) { System.Diagnostics.Debug.WriteLine(fanId + " unfollwing " + bandId); if (Sessions.isAuthenticated(Request, Session)) { string response = await clsFanRequests.GetBandStats(fanId, bandId); System.Diagnostics.Debug.WriteLine(response); string ParsedMessage = ErrorParser.parse(response); if (!ParsedMessage.Equals("")) { ViewBag.Message = "Something went wrong"; return(Json("")); } string j = DataParser.parseResponse(response).Data; //return Json(j); return(Json(new { Followers = 1200000, Calification = 5 })); } else { return(View("~/Views/Login/Index.cshtml")); } }
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)); }
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)); }
// GET: Register public async Task <ActionResult> Fan() { if (Sessions.isAuthenticated(Request, Session)) { int sessionRol = Int32.Parse(Session["rol"].ToString()); if (Sessions.isBand(sessionRol)) { return(RedirectToAction("Index", "Bands", new { area = "Bands", userId = Session["id"] })); } else if (Sessions.isFan(sessionRol)) { return(RedirectToAction("Index", "Fans", new { area = "Fans", userId = Session["id"] })); } else { return(HttpNotFound()); } } string response = await clsRegisterRequests.GetRegisterFanForm(); string ParsedMessage = ErrorParser.parse(response); //Hubo error if (!ParsedMessage.Equals("")) { ViewBag.Message = ParsedMessage; return(RedirectToAction("Index")); } Form formModel = DataParser.parseFanForm(response); return(View(formModel)); }
public async Task <ActionResult> UpdateProfile(string inputName, string inputDateCreation, string inputHashtag, int selectCountry, List <int> selectGenres, List <string> inputMembers, string inputBiography, string profilePicture) { if (Sessions.isAuthenticated(Request, Session)) { PostRegisterBandForm form = new PostRegisterBandForm(); form.Name = inputName; form.DateCreation = inputDateCreation; form.Hashtag = inputHashtag; form.Country = selectCountry; form.Genres = selectGenres; form.Members = inputMembers; form.Biography = inputBiography; form.Picture = profilePicture; string response = await clsBandRequests.UpdateProfile((int)Session["Id"], form); System.Diagnostics.Debug.WriteLine("form posted", response); string ParsedMessage = ErrorParser.parse(response); if (!ParsedMessage.Equals("")) { ViewBag.Message = ParsedMessage; } Session["Name"] = form.Name; return(RedirectToAction("Edit", "Bands", new { area = "Bands", userId = Session["id"] })); } else { return(View("~/Views/Login/Index.cshtml")); } }
public async Task <ActionResult> Edit(int userId) { string response = await clsBandRequests.GetBandInfo(userId); //Hubo error if (!ErrorParser.parse(response).Equals("")) { ViewBag.Message = "F**k my life..."; } System.Diagnostics.Debug.WriteLine(response); string response2 = await clsRegisterRequests.GetRegisterBandForm(); string ParsedMessage = ErrorParser.parse(response2); string response3 = await clsBandRequests.getBandAlbums(userId); BandProfileViewModel profile = new BandProfileViewModel(); profile.Id = Int32.Parse(Session["Id"].ToString()); profile.Username = Session["Username"].ToString(); profile.Name = Session["Name"].ToString(); profile.Info = DataParser.parseBandInfo(response); profile.EditForm = DataParser.parseBandForm(response2); profile.Albums = DataParser.parseAlbums(response3); return(View(profile)); }
public async Task <ActionResult> NewEvent(int userId, string EventTitle, string EventDate, string EventTime, bool EventType, string EventState, string EventLocation, string EventContent) { System.Diagnostics.Debug.WriteLine(userId); System.Diagnostics.Debug.WriteLine(EventTitle); System.Diagnostics.Debug.WriteLine(EventDate); System.Diagnostics.Debug.WriteLine(EventTime); System.Diagnostics.Debug.WriteLine(EventType); System.Diagnostics.Debug.WriteLine(EventState); System.Diagnostics.Debug.WriteLine(EventLocation); System.Diagnostics.Debug.WriteLine(EventContent); clsEvent form = new clsEvent(); form.Date = EventDate; form.Description = EventContent; form.IsConcert = EventType; form.State = EventState; form.Location = EventLocation; form.Time = EventTime; form.Date = EventDate; form.Title = EventTitle; string response = await clsBandRequests.getBandAlbums(userId); string response2 = await clsEventRequests.createEvent(userId, form); //Hubo error if (!ErrorParser.parse(response).Equals("")) { ViewBag.Message = "Something wrong with, create event"; } BandProfileViewModel profile = new BandProfileViewModel(); profile.Id = Int32.Parse(Session["Id"].ToString()); profile.Username = Session["Username"].ToString(); profile.Name = Session["Name"].ToString(); profile.Albums = DataParser.parseAlbums(response); int Id = DataParser.parseEventForm(response2); System.Diagnostics.Debug.WriteLine("Got id: " + Id); return(Json(new { redirectUrl = Url.Action("Index", "Events", new { userId = Int32.Parse(Session["Id"].ToString()), id = Id }), isRedirect = true })); }
public async Task <ActionResult> GetSearch() { //[Bandas,Posts] string response = await clsUserRequests.GetSearchParams(); //Hubo error if (!ErrorParser.parse(response).Equals("")) { ViewBag.Message = "F**k my life..."; } Form SearchParams = DataParser.parseSearchParams(response); return(Json(JsonConvert.SerializeObject(SearchParams), JsonRequestBehavior.AllowGet)); }
public async Task <ActionResult> Login(string inputUsername, string inputPassword) { if (Sessions.isAuthenticated(Request, Session)) { return(RedirectToAction("Index", "Fans", new { area = "Fans", userId = Session["id"] })); } PostLoginUserForm form = new PostLoginUserForm(); form.Username = inputUsername; form.Password = inputPassword; string response = await clsLoginRequests.PostLoginUserForm(form); System.Diagnostics.Debug.WriteLine(response); string ParsedMessage = ErrorParser.parse(response); //Hubo error if (!ParsedMessage.Equals("")) { ViewBag.Message = ParsedMessage; return(View("~/Views/Login/Index.cshtml")); } UserSession session = DataParser.parseUserForm(response); string token = Guid.NewGuid().ToString(); Session["token"] = token; Session["username"] = session.Username; Session["id"] = session.Id; Session["rol"] = session.Rol; Session["name"] = session.Name; Session.Timeout = 10; if (Sessions.isBand(session.Rol)) { return(RedirectToAction("Index", "Bands", new { area = "Bands", userId = session.Id })); } else if (Sessions.isFan(session.Rol)) { return(RedirectToAction("Index", "Fans", new { area = "Fans", userId = session.Id })); } else { return(HttpNotFound()); } }
public async Task <ActionResult> RegisterBand(string inputUsername, string inputPassword, string inputConfirmPassword, string inputName, string inputHashtag, string inputDateCreation, int selectCountry, List <int> selectGenres, List <string> inputMembers, string inputBiography, string profilePicture) { if (Sessions.isAuthenticated(Request, Session)) { int sessionRol = Int32.Parse(Session["rol"].ToString()); if (Sessions.isBand(sessionRol)) { return(RedirectToAction("Index", "Bands", new { area = "Bands", userId = Session["id"] })); } else if (Sessions.isFan(sessionRol)) { return(RedirectToAction("Index", "Fans", new { area = "Fans", userId = Session["id"] })); } else { return(HttpNotFound()); } } PostRegisterBandForm form = new PostRegisterBandForm(); form.Username = inputUsername; form.Password = inputPassword; form.ConfirmPassword = inputConfirmPassword; form.Name = inputName; form.Hashtag = inputHashtag; form.DateCreation = inputDateCreation; form.Country = selectCountry; form.Genres = selectGenres; form.Members = inputMembers; form.Biography = inputBiography; form.Picture = profilePicture; string response = await clsRegisterRequests.PostRegisterBandForm(form); string ParsedMessage = ErrorParser.parse(response); if (!ParsedMessage.Equals("")) { ViewBag.Message = ParsedMessage; return(RedirectToAction("Index")); } ViewBag.Message = "We are glad to have you onboard!"; return(RedirectToAction("Index", "Login")); }
public async Task <ActionResult> RegisterFan(string inputUsername, string inputPassword, string inputConfirmPassword, string inputName, string inputBirthday, int selectGender, int selectCountry, List <int> selectGenres, string profilePicture) { if (Sessions.isAuthenticated(Request, Session)) { int sessionRol = Int32.Parse(Session["rol"].ToString()); if (Sessions.isBand(sessionRol)) { return(RedirectToAction("Index", "Bands", new { area = "Bands", userId = Session["id"] })); } else if (Sessions.isFan(sessionRol)) { return(RedirectToAction("Index", "Fans", new { area = "Fans", userId = Session["id"] })); } else { return(HttpNotFound()); } } RegisterFanForm form = new RegisterFanForm(); form.Username = inputUsername; form.Password = inputPassword; form.ConfirmPassword = inputConfirmPassword; form.Name = inputName; form.Birthday = inputBirthday; form.Gender = selectGender; form.Country = selectCountry; form.Genres = selectGenres; form.Picture = profilePicture; string response = await clsRegisterRequests.PostRegisterFanForm(form); System.Diagnostics.Debug.WriteLine(response); string ParsedMessage = ErrorParser.parse(response); if (!ParsedMessage.Equals("")) { ViewBag.Message = ParsedMessage; return(View("Index")); } ViewBag.Message = "We are glad to have you onboard!"; return(RedirectToAction("Index", "Login")); }
public async Task <ActionResult> ValidateUsername(string Username) { System.Diagnostics.Debug.WriteLine(Username); string response = await clsRegisterRequests.ValidateUsername(Username); string ParsedMessage = ErrorParser.parse(response); //Hubo error if (!ParsedMessage.Equals("")) { System.Diagnostics.Debug.WriteLine("Already exists"); return(Json(true)); } else { return(Json(false)); } }
public async Task <ActionResult> Create(int userId) { string response = await clsBandRequests.getBandAlbums(userId); //Hubo error if (!ErrorParser.parse(response).Equals("")) { ViewBag.Message = "Something wrong with, create event"; } BandProfileViewModel profile = new BandProfileViewModel(); profile.Id = Int32.Parse(Session["Id"].ToString()); profile.Username = Session["Username"].ToString(); profile.Name = Session["Name"].ToString(); profile.Albums = DataParser.parseAlbums(response); return(View(profile)); }
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)); }
public async Task <ActionResult> UpdateProfile(string inputName, string inputBirthday, int selectGender, int selectCountry, List <int> selectGenres, string profilePicture) { System.Diagnostics.Debug.WriteLine(selectGender); System.Diagnostics.Debug.WriteLine(selectCountry); if (Sessions.isAuthenticated(Request, Session)) { RegisterFanForm form = new RegisterFanForm(); form.Name = inputName; form.Birthday = inputBirthday; form.Gender = selectGender; form.Country = selectCountry; form.Genres = selectGenres; form.Picture = profilePicture; string response = await clsFanRequests.UpdateProfile((int)Session["Id"], form); System.Diagnostics.Debug.WriteLine("form pytted", response); string ParsedMessage = ErrorParser.parse(response); if (!ParsedMessage.Equals("")) { ViewBag.Message = ParsedMessage; } try { Session["Name"] = form.Name; } catch (NullReferenceException) { //Not logged in ViewBag.Message = "Please log in first"; return(View("~/Views/Login/Index.cshtml")); } return(RedirectToAction("Edit", "Fans", new { area = "Fans", userId = Session["id"] })); } else { return(View("~/Views/Login/Index.cshtml")); } }
public new async Task <ActionResult> Profile(int userId) { string response = await clsBandRequests.GetBandInfo(userId); string response2 = await clsBandRequests.getBandAlbums(userId); //Hubo error if (!ErrorParser.parse(response).Equals("")) { ViewBag.Message = "F**k my life..."; } BandProfileViewModel profile = new BandProfileViewModel(); profile.Id = Int32.Parse(Session["Id"].ToString()); profile.Username = Session["Username"].ToString(); profile.Name = Session["Name"].ToString(); profile.Info = DataParser.parseBandInfo(response); profile.Albums = DataParser.parseAlbums(response2); return(View(profile)); }
public async Task <ActionResult> isFollowingBand(int fanId, int bandId) { System.Diagnostics.Debug.WriteLine(fanId + "follows? " + bandId); if (Sessions.isAuthenticated(Request, Session)) { string response = await clsFanRequests.isFollowingBand(fanId, bandId); System.Diagnostics.Debug.WriteLine(response); string ParsedMessage = ErrorParser.parse(response); if (!ParsedMessage.Equals("")) { ViewBag.Message = "Something went wrong"; return(Json(new { state = false })); } return(Json(new { state = true })); } else { return(View("~/Views/Login/Index.cshtml")); } }