Пример #1
0
        public async Task <IHttpActionResult> PutStorage(Guid id, StorageViewModel storage)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != storage.Id)
            {
                return(BadRequest());
            }
            storage.Id = id;
            try
            {
                await _storageRepository.EditAsync(storage.ToModel());
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StorageExist(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }