Skip to content

Commit 528d2fe

Browse files
committed
ctrl + shift + i
1 parent bcb60df commit 528d2fe

File tree

7 files changed

+21
-29
lines changed

7 files changed

+21
-29
lines changed

Controllers/PostController.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ public async Task<IActionResult> CreatePost (int userId, Post p)
2929
{
3030
Redirect ("/");
3131
}
32-
Post newPost = new Post(){
33-
Title=p.Title,
34-
Content=p.Content,
35-
UserId=p.UserId
32+
Post newPost = new Post ()
33+
{
34+
Title = p.Title,
35+
Content = p.Content,
36+
UserId = p.UserId
3637
};
3738
if (p.FormImage != null)
3839
{
@@ -46,13 +47,13 @@ public async Task<IActionResult> CreatePost (int userId, Post p)
4647
}
4748
else
4849
{
49-
return Json (new { msg = "not ok 2", error="Post Image must be 1 MB or less!" });
50+
return Json (new { msg = "not ok 2", error = "Post Image must be 1 MB or less!" });
5051
}
5152
}
5253
}
53-
_context.Create(newPost);
54+
_context.Create (newPost);
5455
// return View("_Post", newPost);
55-
return Json (new { msg = "ok", post = newPost});
56+
return Json (new { msg = "ok", post = newPost });
5657
}
5758

5859
}

Controllers/UserController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public IActionResult UserEdit (int userId)
4343
return View (update);
4444
}
4545

46-
[HttpPost ("user/{userId}/update")]
46+
[HttpPost ("user/{userId}/update")]
4747
public async Task<IActionResult> UserPost (int userId, UpdateUser u)
4848
{
4949
// get userid from session

Models/ErrorViewModel.cs

Lines changed: 0 additions & 11 deletions
This file was deleted.

Models/Post.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ public class Post
1010
{
1111
[Key]
1212
public int PostId { get; set; }
13-
[Required (ErrorMessage="Your Post must have a Title!")]
13+
14+
[Required (ErrorMessage = "Your Post must have a Title!")]
1415
public string Title { get; set; }
16+
1517
[NotMapped]
1618
public IFormFile FormImage { get; set; }
1719
public byte[] Image { get; set; }
18-
[Required (ErrorMessage="Your Post must have Content!")]
20+
21+
[Required (ErrorMessage = "Your Post must have Content!")]
1922
public string Content { get; set; }
2023
public int UserId { get; set; }
2124
public User OriginalPoster { get; set; }

Models/User.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public class User
3434
public DateTime CreatedAt { get; set; } = DateTime.Now;
3535
public DateTime UpdatedAt { get; set; } = DateTime.Now;
3636

37-
// We us the NotMapped Annotation so that this variable doesn't end up in our database.
3837
[NotMapped]
3938
[Compare ("Password", ErrorMessage = "Confirm Password must match Password!")]
4039
[DataType (DataType.Password)]

Program.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ namespace connections
1212
{
1313
public class Program
1414
{
15-
public static void Main(string[] args)
15+
public static void Main (string[] args)
1616
{
17-
CreateWebHostBuilder(args).Build().Run();
17+
CreateWebHostBuilder (args).Build ().Run ();
1818
}
1919

20-
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21-
WebHost.CreateDefaultBuilder(args)
22-
.UseStartup<Startup>();
20+
public static IWebHostBuilder CreateWebHostBuilder (string[] args) =>
21+
WebHost.CreateDefaultBuilder (args)
22+
.UseStartup<Startup> ();
2323
}
24-
}
24+
}

Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public void Configure (IApplicationBuilder app, IHostingEnvironment env)
3535
{
3636
app.UseDeveloperExceptionPage ();
3737
app.UseStaticFiles ();
38-
app.UseSession();
38+
app.UseSession ();
3939
app.UseMvc ();
4040
}
4141
}

0 commit comments

Comments
 (0)