예제 #1
0
        public async Task <IHttpActionResult> Post(LayoutViewModel model)
        {
            var allowed = await userService.HasPermission(User.Identity.GetUserId(), PermissionType.Designer, null);

            if (!allowed)
            {
                return(BadRequest("User is not authorised to perform this action"));
            }

            Layout layout = await layoutService.GetOrCreateAsync(model.LayoutId);

            layout.Name   = model.Name;
            layout.Body   = model.Body;
            layout.SiteId = model.SiteId;
            await layoutService.UpdateAsync(layout);

            return(Ok());
        }