コード例 #1
0
        /// <summary>
        /// Update a component in the component database
        /// </summary>
        /// <param name="id">Component id to update</param>
        /// <param name="updateComponentViewModel">Values to change on the component</param>
        /// <returns></returns>
        public async Task UpdateComponent(int id, UpdateComponentViewModel updateComponentViewModel)
        {
            var component = await ComponentDatabase.GetById(id);

            if (component == null)
            {
                throw new Exception($"the requested id - {id} - was not found.");
            }

            component.Status = updateComponentViewModel.Status;
        }
コード例 #2
0
        public async Task <ActionResult> UpdateComponent([FromRoute] int id, [FromQuery] UpdateComponentViewModel updateComponentView)
        {
            await _componentService.UpdateComponent(id, updateComponentView);

            return(Ok(id));
        }