mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-02-02 13:07:34 +00:00
Fix even more bugs.
This commit is contained in:
parent
dbce55459f
commit
1abd027bdb
2 changed files with 16 additions and 0 deletions
|
@ -104,6 +104,15 @@ namespace Project_Unite.Controllers
|
||||||
return Redirect(returnUrl);
|
return Redirect(returnUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult GetUsername(string id)
|
||||||
|
{
|
||||||
|
var db = new ApplicationDbContext();
|
||||||
|
var usr = db.Users.FirstOrDefault(x => x.Id == id);
|
||||||
|
if (usr == null)
|
||||||
|
return new HttpStatusCodeResult(404);
|
||||||
|
return Content(usr.DisplayName);
|
||||||
|
}
|
||||||
|
|
||||||
public ActionResult ChangeUserName(string id, string newName)
|
public ActionResult ChangeUserName(string id, string newName)
|
||||||
{
|
{
|
||||||
var db = new ApplicationDbContext();
|
var db = new ApplicationDbContext();
|
||||||
|
|
|
@ -68,6 +68,13 @@ namespace Project_Unite
|
||||||
actionname = split[2];
|
actionname = split[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string paramsequence = actionname.Substring(actionname.IndexOf("?"));
|
||||||
|
actionname = actionname.Replace(paramsequence, "");
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
var asm = Assembly.GetExecutingAssembly();
|
var asm = Assembly.GetExecutingAssembly();
|
||||||
var ctl = asm.GetTypes().FirstOrDefault(x => x.Name == controllername + "Controller");
|
var ctl = asm.GetTypes().FirstOrDefault(x => x.Name == controllername + "Controller");
|
||||||
var adm = ctl.GetCustomAttributes(false).FirstOrDefault(x => x is RequiresAdmin);
|
var adm = ctl.GetCustomAttributes(false).FirstOrDefault(x => x is RequiresAdmin);
|
||||||
|
|
Loading…
Add table
Reference in a new issue