public async Task <IHttpActionResult> Put(Guid id, [FromBody] WidgetContainerAddOrUpdateViewModel model)
        {
            if (id != model.Id)
            {
                return(BadRequest());
            }

            var serviceRes = await _wdgetContainerService.Edit(new WidgetContainerEditRequest()
            {
                RequestOwner      = User,
                Model             = model,
                WidgetContainerId = id
            });

            if (serviceRes.Access == ResponseAccess.Granted)
            {
                return(Ok(serviceRes));
            }

            if (serviceRes.Access == ResponseAccess.Deny)
            {
                return(Unauthorized(serviceRes.Message));
            }

            return(BadRequest());
        }
        public async Task <IHttpActionResult> Post(WidgetContainerAddOrUpdateViewModel model)
        {
            var serviceRes = await _wdgetContainerService.Add(new WidgetContainerAddRequest()
            {
                RequestOwner = User,
                Model        = model
            });

            if (serviceRes.Access == ResponseAccess.Granted)
            {
                return(Ok(serviceRes.Model));
            }

            if (serviceRes.Access == ResponseAccess.Deny)
            {
                return(Unauthorized(serviceRes.Message));
            }

            return(BadRequest());
        }
 public static WidgetContainer MapToModel(this WidgetContainerAddOrUpdateViewModel viewModel, WidgetContainer existing) => Mapper.Map(viewModel, existing);
 public static WidgetContainer MapToModel(this WidgetContainerAddOrUpdateViewModel viewModel) => Mapper.Map <WidgetContainer>(viewModel);