public ActionResult UpdateProfilePicture(int id, int? seminarId, bool admin = false)
{
var person = _personRepository.GetNullableById(id);
if (person == null)
{
Message = string.Format(Messages.NotFound, "Person", id);
return this.RedirectToAction(a => a.SiteList());
}
// validate this is the person or is a person in user role
if (person.User.LoweredUserName != CurrentUser.Identity.Name.ToLower() && !Roles.IsUserInRole(RoleNames.User))
{
return this.RedirectToAction<ErrorController>(a => a.NotAuthorized());
}
// set this to check for admin routing back to attendee edit page
ViewBag.SeminarId = seminarId;
ViewBag.Admin = admin;
return View(person);
}