public JsonResult UpdateUserManagement(Models.PlatformManageAppSettings n) { try { string currentUser = User.Identity.GetUserName().ToLower(); using (var context = new Repository.BetaDepotContext()) { var membership = context.ApplicationTeamMembers.Where(w => w.TeamMember.UserName.ToUpper() == currentUser.ToUpper() && w.ApplicationId == n.AppId) .FirstOrDefault(); membership.ReceiveBuildNotifications = n.IsReceivingBuildNotifications; context.SaveChanges(); } } catch { return(Json(new { Msg = Common.Constants.APPLICATION_JSON_RESULT_ERROR })); } return(Json(new { Msg = Common.Constants.APPLICATION_JSON_RESULT_SUCCESS })); }
public ViewResult ManageAppSettings(string platform, int id) { if (!Repository.Managers.ApplicationBuildMgr.IsUserAnAppTeamMember(User.Identity.GetUserName(), id)) { throw new HttpException(403, "You are not a team member of this app."); } string currentUser = User.Identity.GetUserName().ToLower(); Models.PlatformManageAppSettings mdl = new Models.PlatformManageAppSettings(); using (var context = new Repository.BetaDepotContext()) { var membership = context.ApplicationTeamMembers.Where(w => w.TeamMember.UserName.ToUpper() == currentUser.ToUpper() && w.ApplicationId == id) .FirstOrDefault(); if (membership != null) { mdl.AppId = id; mdl.IsReceivingBuildNotifications = membership.ReceiveBuildNotifications; } } return(View(mdl)); }
public ViewResult ManageAppSettings(string platform, int id) { if (!Repository.Managers.ApplicationBuildMgr.IsUserAnAppTeamMember(User.Identity.GetUserName(), id)) throw new HttpException(403, "You are not a team member of this app."); string currentUser = User.Identity.GetUserName().ToLower(); Models.PlatformManageAppSettings mdl = new Models.PlatformManageAppSettings(); using (var context = new Repository.BetaDepotContext()) { var membership = context.ApplicationTeamMembers.Where(w => w.TeamMember.UserName.ToUpper() == currentUser.ToUpper() && w.ApplicationId == id) .FirstOrDefault(); if(membership != null) { mdl.AppId = id; mdl.IsReceivingBuildNotifications = membership.ReceiveBuildNotifications; } } return View(mdl); }