Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
</site>
<site name="Twitter" id="2">
<application path="/" applicationPool="Twitter AppPool">
<virtualDirectory path="/" physicalPath="C:\Users\Samirah Alhusayni\Documents\Hackathon-Project\Twitter\Twitter" />
<virtualDirectory path="/" physicalPath="C:\Users\WIN\Desktop\Hackathon-Project-main\Twitter\Twitter" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:32681:localhost" />
Expand Down
Binary file added .vs/Twitter/v16/.suo
Binary file not shown.
1 change: 0 additions & 1 deletion README.md

This file was deleted.

File renamed without changes.
Binary file removed Twitter/.vs/Twitter/v16/.suo
Binary file not shown.
54 changes: 54 additions & 0 deletions Twitter/Controllers/FavouritesController .cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Twitter.Data;
using Twitter.Models;

namespace Twitter.Controllers
{
public class FavouritesController : Controller
{
private readonly ApplicationDbContext _db;
private readonly UserManager<IdentityUser> _userManager;
private object p;
[ActivatorUtilitiesConstructor]
public FavouritesController(ApplicationDbContext db, UserManager<IdentityUser> userManager)
{
_db = db;
_userManager = userManager;
}
public FavouritesController()
{
}
public IActionResult Index()
{
var userId = _userManager.GetUserId(User);
var favList = _db.Favorites.Where(f => f.UserId == userId)
.Include(f => f.Tweet).ToList();
var favEvents = new List<TweetModel>();
foreach (var fav in favList)
favEvents.Add(fav.Tweet);
ViewData["favEvents"] = favEvents;
return View();
}
// POST: /Events/delete/id
[HttpPost]
public IActionResult Delete(int? id)
{
var userId = _userManager.GetUserId(User);
var Favorits = _db.Favorites.First(f => f.TweetId == id && f.UserId == userId);
if (id == null || Favorits == null)
{
return View("_NotFound");
}
_db.Favorites.Remove(Favorits);
_db.SaveChanges();
return RedirectToAction("Index");
}
}
}
1 change: 1 addition & 0 deletions Twitter/Hackathon-Project
Submodule Hackathon-Project added at 600297
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
<PropertyGroup>
<View_SelectedScaffolderID>RazorViewEmptyScaffolder</View_SelectedScaffolderID>
<View_SelectedScaffolderCategoryPath>root/Common/MVC/View</View_SelectedScaffolderCategoryPath>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
</PropertyGroup>
</Project>
3 changes: 0 additions & 3 deletions Twitter/Twitter/bin/Debug/net5.0/Twitter.StaticWebAssets.xml

This file was deleted.

Binary file removed Twitter/Twitter/bin/Debug/net5.0/Twitter.Views.dll
Binary file not shown.
Binary file removed Twitter/Twitter/bin/Debug/net5.0/Twitter.dll
Binary file not shown.

This file was deleted.

Binary file removed Twitter/Twitter/bin/Debug/net5.0/ref/Twitter.dll
Binary file not shown.

This file was deleted.

Binary file removed Twitter/Twitter/obj/Debug/net5.0/Twitter.Views.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file removed Twitter/Twitter/obj/Debug/net5.0/Twitter.dll
Binary file not shown.

This file was deleted.

Binary file removed Twitter/Twitter/obj/Debug/net5.0/ref/Twitter.dll
Binary file not shown.

This file was deleted.

This file was deleted.

126 changes: 0 additions & 126 deletions Twitter/Twitter/obj/project.nuget.cache

This file was deleted.

1 change: 1 addition & 0 deletions Twitter/Views/Home/Delete.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Delete</h1>
6 changes: 6 additions & 0 deletions Twitter/Views/Home/Privacy.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>

<p>Use this page to detail your site's privacy policy.</p>
1 change: 1 addition & 0 deletions Twitter/Views/Home/Reply.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Reply</h1>
1 change: 1 addition & 0 deletions Twitter/Views/Home/TweeT.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<h1>Tweet</h1>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=LAPTOP-NHP8C8BL;Database=aspnet-Twitter;Trusted_Connection=True;MultipleActiveResultSets=true"
"DefaultConnection": "Server=DESKTOP-SP2UVRT\\SQLEXPRESS01;Database=aspnet-Twitter;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"LogLevel": {
Expand Down
3 changes: 3 additions & 0 deletions Twitter/bin/Debug/net5.0/Twitter.StaticWebAssets.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<StaticWebAssets Version="1.0">
<ContentRoot BasePath="/Identity" Path="C:\Users\WIN\.nuget\packages\microsoft.aspnetcore.identity.ui\5.0.7\staticwebassets\V4\" />
</StaticWebAssets>
Binary file added Twitter/bin/Debug/net5.0/Twitter.Views.dll
Binary file not shown.
Binary file not shown.
Binary file added Twitter/bin/Debug/net5.0/Twitter.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions Twitter/bin/Debug/net5.0/Twitter.runtimeconfig.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"runtimeOptions": {
"additionalProbingPaths": [
"C:\\Users\\WIN\\.dotnet\\store\\|arch|\\|tfm|",
"C:\\Users\\WIN\\.nuget\\packages"
]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=LAPTOP-NHP8C8BL;Database=aspnet-Twitter;Trusted_Connection=True;MultipleActiveResultSets=true"
"DefaultConnection": "Server=DESKTOP-SP2UVRT\\SQLEXPRESS01;Database=aspnet-Twitter;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"LogLevel": {
Expand Down
Binary file added Twitter/bin/Debug/net5.0/ref/Twitter.dll
Binary file not shown.
Loading