mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 17:22:15 +00:00
middle-end for user posts
This commit is contained in:
parent
7f865f478a
commit
1d4e39678f
1 changed files with 13 additions and 0 deletions
|
@ -3,6 +3,7 @@
|
|||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Project_Unite.Models;
|
||||
|
||||
namespace Project_Unite.Controllers
|
||||
|
@ -25,5 +26,17 @@ public ActionResult ViewProfile(string id)
|
|||
|
||||
return View(user);
|
||||
}
|
||||
|
||||
public ActionResult PostContent(UserPost model)
|
||||
{
|
||||
var db = new ApplicationDbContext();
|
||||
model.Id = Guid.NewGuid().ToString();
|
||||
model.PostedAt = DateTime.Now;
|
||||
model.UserId = User.Identity.GetUserId();
|
||||
db.UserPosts.Add(model);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("ViewProfile", "Profiles", new { id = ACL.UserNameRaw(User.Identity.GetUserId()) });
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue