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));
        }
Esempio n. 2
0
        public JsonResult UpdateAccessLevel(UpdateAccountAccessLevelToWebsite model)
        {
            var ewhWebsite = _websiteManager.GetEwhWebsite("");//model.WebsiteId);

            if (ewhWebsite.UpdateAccessLevel(model))
            {
                return(Json(ewhWebsite, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { Status = ewhWebsite.EwhStatus.ToString(), Ex = ewhWebsite.EwhException, Msg = ewhWebsite.EwhErrorMessage }, JsonRequestBehavior.AllowGet));
        }
 public IHttpActionResult UpdateWebsite(string websiteId, WebsiteDetailDto dto)
 {
     dto.WebsiteId = websiteId;
     if (ModelState.IsValid)
     {
         var website = _websiteManager.GetEwhWebsite(dto.WebsiteId);
         if (website != null && website.IsExits())
         {
             if (_websiteManager.UpdateWebsite(dto.ToEntity(website)))
             {
                 EwhLogger.Common.Info("FullUpdate End");
                 return(Ok(dto));
             }
             return(ServerError(_websiteManager as EwhEntityBase));
         }
         else
         {
             return(BadRequest());
         }
         return(ServerError(_websiteManager as EwhEntityBase));
     }
     return(BadRequest());
 }