public IActionResult PartnerActions(int partnerId) { if (!IsUserAllowedForPartner(partnerId)) { return(Unauthorized()); } var user = _userFactory.GetUser(User.Identity.Name); if (User.IsInRole(WebConstants.AdminRole)) { if (user.PartnerId != partnerId) { user.PartnerId = partnerId; _userFactory.UpdateUser(user); } } var partner = _partnerFactory.GetPartner(partnerId); ViewData["PartnerId"] = partnerId; ViewData["PartnerName"] = partner.Name; var model = _partnerActionMapFactory.GetActionsForPartnerActionsView(partnerId, user.Id); return(View(model)); }
// GET: Admin/Partners/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var partner = _partnerFactory.GetPartner(id); if (partner == null) { return(NotFound()); } return(View(partner)); }
/// <summary> /// /// </summary> /// <param name="id">Partner Id</param> /// <returns></returns> public IActionResult ViewByAction(int id) { // add error handling int userId = int.Parse(User.FindFirst(x => x.Type == ClaimTypes.NameIdentifier).Value); var model = _partnerActionMapFactory.GetActionsForViewByAction(id, userId); var partner = _partnerFactory.GetPartner(id); ViewData["PartnerName"] = partner.Name; ViewData["PartnerId"] = id; ViewData["CategoryName"] = partner.PartnerTypeName; ViewData["CategoryId"] = partner.PartnerTypeId; return(View(model)); }