public IHttpActionResult AddWebsiteAccount(string userId, string websiteId, AddWebsitePermissionDto dto) { var ewhWebsite = _websiteManager.GetEwhWebsite(websiteId); if (ewhWebsite == null) { return(NotFound()); } //dto.AccountId = userId; //dto.WebsiteId = websiteId; if (dto.AccessLevels == null || !dto.AccessLevels.Any()) { dto.AccessLevels = new List <string>() { "dev", "test" } } ; if (ewhWebsite.AddAccount(new AddWebsiteAccountDto() { AccessLevels = dto.AccessLevels, AccountId = userId })) { return(NoContent()); } return(ServerError(ewhWebsite)); }
public IHttpActionResult AddUser(string websiteId, string userId, AddWebsitePermissionDto dto) { var accountController = GlobalConfiguration.Configuration.DependencyResolver.GetService(typeof(AccountController)) as AccountController; accountController.ControllerContext = this.ControllerContext; return(accountController.AddWebsiteAccount(userId, websiteId, dto)); }
public IHttpActionResult UpdateWebsiteAccessLevel(string userId, string websiteId, AddWebsitePermissionDto dto) { var ewhWebsite = _websiteManager.GetEwhWebsite(websiteId); if (ewhWebsite == null) { return(NotFound()); } //dto.AccountId = userId; //dto.WebsiteId = websiteId; if (dto.AccessLevels == null || !dto.AccessLevels.Any()) { dto.AccessLevels = new List <string>() { "dev", "test" } } ; if (ewhWebsite.UpdateAccessLevel(new UpdateAccountAccessLevelToWebsite() { AccessLevels = dto.AccessLevels, AccountId = userId })) { //var ewhAccount = _accountManager.GetEwhAccount(userId); //ewhAccount.UpdateWebsiteName(); return(NoContent()); } return(ServerError(ewhWebsite)); }