示例#1
0
        public IHttpActionResult Put(Guid id, [FromBody] UpdateClashModel command, bool applyGlobally = false)
        {
            if (!ModelState.IsValid || id == default || command == null)
            {
                return(this.Error().InvalidParameters());
            }

            var clash = _clashRepository.Get(id);

            if (clash == null)
            {
                return(NotFound());
            }

            var updateResult = ValidateAndSaveClash(clash, command, applyGlobally);

            return(updateResult.Success
                ? Ok(clash)
                : this.Error().BadRequest(updateResult.Message));
        }