Beispiel #1
0
        public ActionResult Manage(string id)
        {
            string platform = id;
            string userName = User.Identity.GetUserName();

            Models.PlatformViewManage mdl = new Models.PlatformViewManage();
            mdl.Platform = platform.ToUpper();
            if (id.ToUpper() == Common.Constants.BUILD_PLATFORM_ANDROID)
            {
                mdl.PlatformDesc = "Android";
            }
            else if (id.ToUpper() == Common.Constants.BUILD_PLATFORM_IOS)
            {
                mdl.PlatformDesc = "iOS";
            }

            using (var context = new BetaDepot.Repository.BetaDepotContext())
            {
                List <Repository.Application> apps = (from a in context.Applications
                                                      join tm in context.ApplicationTeamMembers on a.Id equals tm.ApplicationId
                                                      where tm.TeamMember.UserName == userName &&
                                                      a.Platform == platform
                                                      select a).ToList();
                foreach (Repository.Application a in apps)
                {
                    mdl.Apps.Add(new Models.PlatformViewManage.PlatformViewManageApp()
                    {
                        ApplicationIdentifier = a.ApplicationIdentifier,
                        Id                 = a.Id,
                        Name               = a.Name,
                        Platform           = a.Platform,
                        TeamMemberCount    = a.AssignedMembers.Count(),
                        ApplicationRole    = a.AssignedMembers.Where(w => w.TeamMember.UserName.ToLower() == userName.ToLower()).FirstOrDefault().MemberRole,
                        UploadedBuildCount = context.Builds.Where(w => w.Application.Id == a.Id).Count(),
                        AppIconUrl         = Platforms.Common.GenerateAppIconUrl(a.ApplicationIdentifier)
                    });
                }
            }
            return(View(mdl));
        }
        public ActionResult Manage(string id)
        {
            string platform = id;
            string userName = User.Identity.GetUserName();
            Models.PlatformViewManage mdl = new Models.PlatformViewManage();
            mdl.Platform = platform.ToUpper();
            if (id.ToUpper() == Common.Constants.BUILD_PLATFORM_ANDROID)
                mdl.PlatformDesc = "Android";
            else if (id.ToUpper() == Common.Constants.BUILD_PLATFORM_IOS)
                mdl.PlatformDesc = "iOS";
          
            using (var context = new BetaDepot.Repository.BetaDepotContext())
            {


                List<Repository.Application> apps = (from a in context.Applications
                                            join tm in context.ApplicationTeamMembers on a.Id equals tm.ApplicationId
                                            where tm.TeamMember.UserName == userName
                                                && a.Platform == platform
                                            select a).ToList();
                foreach(Repository.Application a in apps)
                {

                    mdl.Apps.Add(new Models.PlatformViewManage.PlatformViewManageApp()
                        {
                            ApplicationIdentifier = a.ApplicationIdentifier,
                            Id = a.Id,
                            Name = a.Name,
                            Platform = a.Platform,
                            TeamMemberCount = a.AssignedMembers.Count(),
                            ApplicationRole = a.AssignedMembers.Where(w => w.TeamMember.UserName.ToLower() == userName.ToLower()).FirstOrDefault().MemberRole,
                            UploadedBuildCount = context.Builds.Where(w => w.Application.Id == a.Id).Count(),
                            AppIconUrl = Platforms.Common.GenerateAppIconUrl(a.ApplicationIdentifier)

                        });
                }
            }
            return View(mdl);
        }