示例#1
0
        public async Task <ActionResult> Update(Guid id, StateViewModel stateViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(OkResult(ModelState));
            }

            if (id != stateViewModel.Id)
            {
                Notify("O id informado é diferente do objeto.");
                return(OkResult());
            }

            await _applicationServiceState.UpdateAsync(stateViewModel);

            return(OkResult());
        }
示例#2
0
        public async Task <ActionResult> UpdateAsync(Guid id, StateViewModel stateViewModel)
        {
            var state = await _applicationServiceState.GetByIdAsync(id);

            if (state == null)
            {
                return(BadRequest());
            }

            if (id != state.Id)
            {
                return(BadRequest());
            }

            await _applicationServiceState.UpdateAsync(stateViewModel);

            return(Ok());
        }