public ActionResult DetailsInternetPackageContract(Guid contractAddressId) { ContractAddress contractAddress = contractAddressActions.Get(contractAddressId); IEnumerable <InternetPackageContract> internetPackageContracts = contractAddress.InternetPackageContracts.OrderByDescending(item => item.Number).ToArray(); IEnumerable <InternetPackage> allInternetPackages = internetPackageActions.GetAllNotCanceled().ToArray(); ViewData["internetPackageId"] = allInternetPackages.Select(item => new SelectListItem() { Text = item.Name, Value = item.Id.ToString() }); ViewData["contractAddress"] = contractAddress; return(PartialView(internetPackageContracts)); }
public ActionResult Create(Guid contractAddressId, Guid internetPackageId) { ContractAddress contractAddress = contractAddressActions.Get(contractAddressId); User user = userActions.GetById(contractAddress.SubscriberId); if (!actions.CanSubscribe(contractAddressId, internetPackageId)) { TempData["notEnoughBalance"] = true; if (User.Identity.Name == user.UserName) { return(RedirectToAction("Index", "User")); } else { return(RedirectToAction("Details", "AdminUser", new { @id = user.Id })); } } if (User.IsInRole("Administrator") || User.IsInRole("Support") || User.Identity.Name == user.UserName) { actions.Create(user.Id, contractAddressId, internetPackageId); if (User.Identity.Name == user.UserName) { return(RedirectToAction("Index", "User")); } else { return(RedirectToAction("Details", "AdminUser", new { @id = user.Id })); } } else { throw new Exception(); } }