示例#1
0
        public ActionResult <Account> PutAccount([FromODataUri] int key, [FromBody] Account account)
        {
            if (!ModelState.IsValid)
            {
                BadRequest(ModelState);
            }

            var result = _repository.RealAll().SingleOrDefault(x => x.Id == key);

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

            if (account.Id != key)
            {
                BadRequest(ModelState);
            }

            _repository.FullUpdate(result, account);

            return(Ok(result));
        }