Exemple #1
0
        public async Task <IHttpActionResult> Put(Guid id, EntitySchemeUpdateViewModel model)
        {
            var res = await _schemeService.UpdateAsync(new EntitySchemeUpdateRequest()
            {
                ViewModel    = model,
                RequestOwner = User
            });

            if (res.Access == ResponseAccess.Granted)
            {
                return(Ok());
            }
            if (res.Access == ResponseAccess.Deny)
            {
                return(Unauthorized());
            }

            return(BadRequest());
        }
Exemple #2
0
        public async Task UpdateSchemeAsync(EntitySchemeUpdateViewModel viewModel)
        {
            var existing = await _schemesDataSrv.GetAsync(viewModel.Id);

            await _schemesDataSrv.UpdateAsync(viewModel.MapToExisting(existing));
        }
 public static EntityScheme MapToExisting(this EntitySchemeUpdateViewModel viewModel, EntityScheme model)
 {
     return(Mapper.Map(viewModel, model));
 }