Пример #1
0
        /// <summary>
        /// Updates tape, throws resource not found exception if no tape is associated to Id
        /// </summary>
        /// <param name="Id">Id associated with tape in system to update</param>
        /// <param name="Tape">New information on tape to swap old information out for</param>
        public void EditTape(int Id, TapeInputModel Tape)
        {
            var oldTape = _tapeRepository.GetAllTapes().FirstOrDefault(t => t.Id == Id);

            if (oldTape == null)
            {
                throw new ResourceNotFoundException($"Video tape with id {Id} was not found.");
            }
            else
            {
                _tapeRepository.EditTape(Id, Tape);
            }
        }