Example #1
0
        // GET: Services/Details/5
        public ActionResult Details(int?id = null)
        {
            if (id == null)
            {
                // Find services for this user
                var servicesList = ModelTools.GetServicesFromUserID(User.Identity.GetUserId());
                if (servicesList.Count > 0)
                {
                    //var myService = new ServiceViewModel();
                    //myService.SubscriptionId = servicesList[0].SubscriptionId;
                    //myService.Description = servicesList[0].Description;
                    //myService.Id = servicesList[0].Id;
                    //myService.cspTenantId = null;

                    // Just pick the first one
                    return(View(servicesList[0]));
                }
                else
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }
            else
            {
                Service service = db.Services.Find(id);
                if (service == null)
                {
                    return(HttpNotFound());
                }
                return(View(service));
            }
        }
Example #2
0
 public ActionResult Index()
 {
     if (User.IsInRole("Admin"))
     {
         return(View(db.Services.ToList()));
     }
     else
     {
         var servicesList = ModelTools.GetServicesFromUserID(User.Identity.GetUserId());
         servicesList = ModelTools.AddEmptyOfferings(servicesList);
         return(View(servicesList));
     }
 }