protected void btnDislike_Click(object sender, EventArgs e) { if (tempLike == null) { tempLike = new Like() { IsLike = false, UserID = userLogeado.UserId, PeliculaID = objSelected.PeliculaId }; Like_BRL.InsertLike(tempLike); } else { if (tempLike.IsLike) { tempLike.IsLike = false; Like_BRL.UpdateLike(tempLike); } else { Like_BRL.DeleteLike(tempLike.LikeID); tempLike = null; } } Response.Redirect("DetallePelicula.aspx?Id=" + objSelected.PeliculaId); }
protected void btnLike_Click(object sender, EventArgs e) { if (tempLike == null) //Si nunca le dio like { tempLike = new Like() { IsLike = true, UserID = userLogeado.UserId, PeliculaID = objSelected.PeliculaId }; Like_BRL.InsertLike(tempLike); } else //Si ya le doy like antes { if (tempLike.IsLike) //Si es like eliminar { Like_BRL.DeleteLike(tempLike.LikeID); tempLike = null; } else //Si ya le habian dado dislike pues actualizo y lo vuelvo like { tempLike.IsLike = true; Like_BRL.UpdateLike(tempLike); } } Response.Redirect("DetallePelicula.aspx?Id=" + objSelected.PeliculaId); }