Beispiel #1
0
        public Botanical removeBotanical(string id)
        {
            if (this.botanicals.ContainsKey(id))
            {
                Botanical originalValue = this.botanicals[id];

                this.botanicals.Remove(id);

                return(originalValue);
            }

            return(null);
        }
        public ActionResult <Botanical> Create([FromBody] Botanical request)
        {
            var botanical = this._service.getBotanical(request.Id);

            if (botanical != null)
            {
                return(Conflict(createErrorMessage("Id already exists id=" + request.Id)));
            }

            var result = this._service.addBotanical(request);

            return(result);
        }
Beispiel #3
0
        public Botanical updateBotanical(string id, Botanical value)
        {
            if (this.botanicals.ContainsKey(id))
            {
                this.botanicals.Remove(id);

                this.botanicals.Add(id, value);

                return(this.botanicals[id]);
            }

            return(null);
        }
        public ActionResult <Botanical> Put(String id, [FromBody] Botanical request)
        {
            var botanical = this._service.getBotanical(id);

            if (botanical == null)
            {
                return(NotFound(createErrorMessage("Botanical does not exist for ID=" + id)));
            }

            var result = this._service.updateBotanical(id, request);

            return(result);
        }
Beispiel #5
0
        public Botanical addBotanical(Botanical value)
        {
            this.botanicals.Add(value.Id, value);

            return(value);
        }