Пример #1
0
        public Item Post(ItemBasic item, bool readOnlyAtLibrary)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            var user   = _folioUserService.ByUserName(AppSettings["foliousername"]);
            var source = new Source
            {
                Id       = user.Id,
                Personal = user.Personal
            };

            item.CirculationNotes.Add(new CirculationNote
            {
                NoteType = "Check in",
                Note     = _chillinTextRepository.ByTextField("checkInNote").CheckInNote,
                Source   = source
            });

            if (readOnlyAtLibrary)
            {
                item.CirculationNotes.Add(new CirculationNote
                {
                    NoteType = "Check out",
                    Note     = _chillinTextRepository.ByTextField("checkOutNote").CheckOutNote,
                    Source   = source
                });
            }

            var response = _folioRepository.Post(path, _jsonService.SerializeObject(item));

            return(_jsonService.DeserializeObject <Item>(response));
        }
        public Instance Post(InstanceBasic item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }
            var response = _folioRepository.Post(path, _jsonService.SerializeObject(item));

            return(_jsonService.DeserializeObject <Instance>(response));
        }