Skip to content

Commit

Permalink
last
Browse files Browse the repository at this point in the history
  • Loading branch information
efdali committed Jul 12, 2019
1 parent 90e0a68 commit 7450e25
Show file tree
Hide file tree
Showing 1,933 changed files with 225,866 additions and 275 deletions.
Binary file modified .vs/FilmPortalı/v15/.suo
Binary file not shown.
Binary file modified .vs/FilmPortalı/v15/Server/sqlite3/storage.ide
Binary file not shown.
Binary file modified .vs/FilmPortalı/v15/Server/sqlite3/storage.ide-shm
Binary file not shown.
Binary file modified .vs/FilmPortalı/v15/Server/sqlite3/storage.ide-wal
Binary file not shown.
14 changes: 11 additions & 3 deletions FilmPortalı/Content/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ header{
width: 175px;
height: 250px;
margin-bottom: 20px;
position:relative;
margin-right:15px;
}

.film-poster{
Expand Down Expand Up @@ -377,6 +379,7 @@ ul.list-container {
}
.yorum{
margin:0px 10px;
flex-basis:80%;
}
.blur-text{
font-size:10px;
Expand All @@ -388,9 +391,12 @@ ul.list-container {

.film-summary{
height: 135px;
overflow: scroll;
overflow: hidden;
display: block;
}
.film-summary:hover{
overflow:visible;
}
.mobile-summary{
display: none;
}
Expand Down Expand Up @@ -431,7 +437,10 @@ ul.list-container {
height: 32px;
}


.remove-list{
position:absolute;
right:8px;
}

/* Tablet ve Header */
@media screen and (max-width:700px){
Expand Down Expand Up @@ -527,7 +536,6 @@ ul.list-container {
.film-box{
width: calc(50% - 10px);
margin-right: 10px;

}
.film-poster{
width: 100%;
Expand Down
Binary file removed FilmPortalı/Content/img/amelia.jpg
Binary file not shown.
Binary file removed FilmPortalı/Content/img/esaretin-bedeli.jpg
Binary file not shown.
Binary file removed FilmPortalı/Content/img/fight_club.jpg
Binary file not shown.
Binary file removed FilmPortalı/Content/img/leon.jpg
Binary file not shown.
Binary file removed FilmPortalı/Content/img/life.jpg
Binary file not shown.
103 changes: 96 additions & 7 deletions FilmPortalı/Controllers/FilmController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,39 @@ public ActionResult FilmDetails(string filmName)
{

FilmDetailsViewModel vm = new FilmDetailsViewModel();
Films film =db.Films
.Where(f => f.FName == filmName).FirstOrDefault();
List<Comments> cmts = db.Comments.Include("SubComments").Where(c => c.CFId == film.FId && c.CStatus==true).ToList();
Films film = db.Films
.Where(f => f.FSeo == filmName).FirstOrDefault();
List<Comments> cmts = db.Comments.Include("SubComments").Where(c => c.CFId == film.FId && c.CStatus == true).OrderBy(c => c.CDate).ToList();
List<FilmSource> src = db.FilmSource.Where(s => s.FId == film.FId).ToList();
List<FilmCrew> crew = db.FilmCrew.Include("Crews").Where(c => c.FId == film.FId && c.FCMission=="Oyuncu").ToList();
List<FilmCrew> crew = db.FilmCrew.Include("Crews").Where(c => c.FId == film.FId && c.FCMission == "Oyuncu").ToList();
FilmCrew director = db.FilmCrew.Include("Crews").Where(fc => fc.FId == film.FId && fc.FCMission == "Yönetmen").FirstOrDefault();
List<Categories> categories = (from c in db.Categories
join fc in db.FilmCategory.Where(fc => fc.FId == film.FId) on c.CId equals fc.CId
select c).ToList();
string category="";
int p = 0;
foreach(Categories cat in categories)
{
category += cat.CAd;
if (p != categories.Count - 1)
{
category += ",";
}
p++;
}
vm.film = film;
vm.comment = cmts;
vm.filmSource = src;
vm.crew = crew;
ViewBag.Director = director;
ViewBag.Categories=category;
return View(vm);
}

[HttpPost]
[ValidateAntiForgeryToken]
[Authorize]
public ActionResult AddComment(string filmId,string commentText)
public ActionResult AddComment(string filmId, string commentText)
{

Comments comments = new Comments();
Expand All @@ -44,7 +61,15 @@ public ActionResult AddComment(string filmId,string commentText)
db.Comments.Add(comments);
db.SaveChanges();

return Content("Başarılı");
return Content("<div class='yorum-container'>" +
"<div class='user'>" +
"<img src=" + Session["kullaniciResim"] + " alt=" + User.Identity.Name + " class='user-image'>" +
"<span>" + User.Identity.Name + "</span>" +
"</div><div class='yorum'>" +
"<span class='blur-text'><i class='far fa-clock'></i>Az Önce</span>" +
"<p style='margin:0'>" + comments.CText + "</p>" +
"</div>" +
"</div>");
}

[HttpPost]
Expand All @@ -64,6 +89,70 @@ public ActionResult AddSubComment(string commentId, string commentText)

return Content("Başarılı");
}

public ActionResult AddLikes(int filmId, int type)
{

int userId = Convert.ToInt16(Session["kullaniciId"]);
List list = null;
list = db.List.Where(l => l.LUId == userId && l.LFId == filmId && l.LType != 0).FirstOrDefault();
if (list != null && list.LType != 0)
{
if (list.LType == -type)
{
list.LType = type;
}
}
else if (list == null)
{
list = new List();
list.LFId = filmId;
list.LUId = userId;
list.LType = type;
db.List.Add(list);
}
db.SaveChanges();
return Content("<i class='far fa-check-circle'></i> Listenizde");
}

public ActionResult AddList(int filmId)
{

int userId = Convert.ToInt16(Session["kullaniciId"]);
List list = null;
list = db.List.Where(l => l.LUId == userId && l.LFId == filmId && l.LType == 0).FirstOrDefault();
if (list == null)
{
list = new List();
list.LFId = filmId;
list.LUId = userId;
list.LType = 0;
db.List.Add(list);
}
db.SaveChanges();
return Content("<i class='far fa-check-circle'></i> Listenizde");
}

public JsonResult CheckList(int filmId)
{
int userId = Convert.ToInt16(Session["kullaniciId"]);
var like = db.List.Where(l => l.LFId == filmId && l.LUId == userId && l.LType != 0).FirstOrDefault();
var list = db.List.Where(l => l.LFId == filmId && l.LUId == userId && l.LType == 0).FirstOrDefault();
return Json(new { InList = list==null ? 0 : 1,InLike = like == null ? 0 : like.LType },JsonRequestBehavior.AllowGet);
}

public ActionResult AddWatched(int filmId) {

string userId = Session["kullaniciId"] == null ? "1" : Session["kullaniciId"].ToString();
Views v = new Views();
v.VFId = filmId;
v.VUId = Convert.ToInt16(userId);
db.Views.Add(v);
db.SaveChanges();
return Content("Başarılı");
}

}

}
}

134 changes: 113 additions & 21 deletions FilmPortalı/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,129 @@ public class HomeController : Controller
// GET: Home
public ActionResult Index()
{
AnasayfaSliderFilmViewModel vm = new AnasayfaSliderFilmViewModel();
List<Slider> slider = db.Slider.Include("Films").Where(s => s.SStatus == true).Take(10).ToList();
List<Films> film = db.Films.OrderBy(f => f.FId).Skip(0).Take(40).ToList();
vm.slider = slider;
vm.film = film;
return View(vm);
ViewBag.Count = db.Films.Count();
return View(slider);
}

public ActionResult Tur(int id)
[Route("Home/GetFilms/{page?}")]
public ActionResult GetFilms(int page = 0)
{
List<Films> films = db.Films.Where(f => f.FYear.Value.Year == id).ToList();
List<Films> films = db.Films.OrderBy(f => f.FId).Skip(page * 40).Take(40).ToList();
return View(films);
}

// GET 2019
[Route("2019")]
public ActionResult Year()
[Route("tur/{tur}")]
public ActionResult Tur(string tur)
{
List<Films> films = db.Films.Where(f => f.FYear.Value.Year == 2019)
.OrderBy(f=>f.FImdb).Skip(0).Take(40).ToList();
ViewBag.Header = "2019 Yılı Filmleri";
return View("Tur",films);
string sort = Request.QueryString["sortBy"] == null ? "imdb" : Request.QueryString["sortBy"];

ViewBag.active = sort;
ViewBag.tur = tur;
ViewBag.Count = db.Films.Count();
return View("Tur");
}
// GET En çok izlenen filmler
[Route("en-cok-izlenenler")]
public ActionResult MostWatchedFilms()

public ActionResult GetType(string tur, string sort, int page = 0)
{
List<Films> films = db.Films.OrderBy(f => f.FImdb).Skip(0).Take(40).ToList();
ViewBag.Header = "En Çok İzlenen Filmler";
return View("Tur", films);
List<Films> films = null;
if (tur == "2019")
{
if (sort == "izlenme")
{
films = db.Films.Where(f => f.FYear.Value.Year == 2019)
.OrderBy(f => f.FUDate).Skip(page * 40).Take(40).ToList();
//films = (from f in db.Films
// join v in db.Views.GroupBy(v => v.VFId).
// Select(v => new { sayi = v.Count(), VFId = v.VFId }) on f.FId equals v.VFId).OrderBy(v.sayi).ToList();

}
else if (sort == "eklenme")
{
films = db.Films.Where(f => f.FYear.Value.Year == 2019)
.OrderBy(f => f.FCDate).Skip(page * 40).Take(40).ToList();
}
else
{
films = db.Films.Where(f => f.FYear.Value.Year == 2019)
.OrderBy(f => f.FImdb).Skip(page * 40).Take(40).ToList();
}
ViewBag.Header = "2019 Yılı Filmleri";
}
else if (tur == "en-cok-izlenenler")
{
if (sort == "izlenme")
{
films = db.Films.OrderBy(f => f.FUDate).Skip(page * 40).Take(40).ToList();
}
else if (sort == "eklenme")
{
films = db.Films.OrderBy(f => f.FCDate).Skip(page * 40).Take(40).ToList();
}
else
{
films = db.Films.OrderBy(f => f.FImdb).Skip(page * 40).Take(40).ToList();
}
ViewBag.Header = "En Çok İzlenen Filmler";
}
else
{
films = (from f in db.Films
join fc in db.FilmCategory on f.FId equals fc.FId
join c in db.Categories.Where(c => c.CAd.Contains(tur)) on fc.CId equals c.CId
select f).OrderBy(f => f.FCDate).Skip(page * 40).Take(40).ToList();

}
return View("GetFilms", films);
}

//// GET 2019
//[Route("2019")]
//public ActionResult Year()
//{
// string sort = Request.QueryString["sortBy"] == null ? "imdb" : Request.QueryString["sortBy"];
// List<Films> films = null;
// if (sort == "izlenme")
// {
// films = db.Films.Where(f => f.FYear.Value.Year == 2019)
// .OrderBy(f => f.FUDate).Skip(0).Take(40).ToList();
// }
// else if (sort == "eklenme")
// {
// films = db.Films.Where(f => f.FYear.Value.Year == 2019)
// .OrderBy(f => f.FCDate).Skip(0).Take(40).ToList();
// }
// else
// {
// films = db.Films.Where(f => f.FYear.Value.Year == 2019)
// .OrderBy(f => f.FImdb).Skip(0).Take(40).ToList();
// }
// ViewBag.active = sort;
// ViewBag.Header = "2019 Yılı Filmleri";
// return View("Tur", films);
//}

//// GET En çok izlenen filmler
//[Route("en-cok-izlenenler")]
//public ActionResult MostWatchedFilms()
//{
// string sort = Request.QueryString["sortBy"] == null ? "imdb" : Request.QueryString["sortBy"];
// List<Films> films = null;
// if (sort == "izlenme")
// {
// films = db.Films.OrderBy(f => f.FUDate).Skip(0).Take(40).ToList();
// }
// else if (sort == "eklenme")
// {
// films = db.Films.OrderBy(f => f.FCDate).Skip(0).Take(40).ToList();
// }
// else
// {
// films = db.Films.OrderBy(f => f.FImdb).Skip(0).Take(40).ToList();
// }
// ViewBag.active = sort;
// ViewBag.Header = "En Çok İzlenen Filmler";
// return View("Tur", films);
//}

}
}
6 changes: 6 additions & 0 deletions FilmPortalı/Controllers/PartialController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,11 @@ public ActionResult Footer()
{
return PartialView();
}

public ActionResult SearchFilm(string val)
{
List<Films> films = db.Films.Where(f => f.FName.ToLower().Contains(val)).Take(5).ToList();
return View(films);
}
}
}
Loading

0 comments on commit 7450e25

Please sign in to comment.