// PUT: odata/BenthicEventConditions(5)
        public IHttpActionResult Put([FromODataUri] int key, Delta <BenthicEventCondition> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            BenthicEventCondition benthicEventCondition = db.BenthicEventConditions.Find(key);

            if (benthicEventCondition == null)
            {
                return(NotFound());
            }

            BenthicEvent @BenthicEvent = db.BenthicEvents.Find(benthicEventCondition.Id);
            var          check         = AuthorizeLogic.VerifyBenthicEventEditPermission(@BenthicEvent);

            if (check)
            {
                patch.Put(benthicEventCondition);

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BenthicEventConditionExists(key))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(Updated(benthicEventCondition));
            }
            else
            {
                return(Unauthorized());
            }
        }
        // POST: odata/BenthicEventConditions
        public IHttpActionResult Post(BenthicEventCondition benthicEventCondition)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            BenthicEvent @BenthicEvent = db.BenthicEvents.Find(benthicEventCondition.Id);
            var          check         = AuthorizeLogic.VerifyBenthicEventEditPermission(@BenthicEvent);

            if (check)
            {
                db.BenthicEventConditions.Add(benthicEventCondition);
                db.SaveChanges();

                return(Created(benthicEventCondition));
            }
            else
            {
                return(Unauthorized());
            }
        }
        // DELETE: odata/BenthicEventConditions(5)
        public IHttpActionResult Delete([FromODataUri] int key)
        {
            BenthicEventCondition benthicEventCondition = db.BenthicEventConditions.Find(key);

            if (benthicEventCondition == null)
            {
                return(NotFound());
            }

            BenthicEvent @BenthicEvent = db.BenthicEvents.Find(benthicEventCondition.Id);
            var          check         = AuthorizeLogic.VerifyBenthicEventEditPermission(@BenthicEvent);

            if (check)
            {
                db.BenthicEventConditions.Remove(benthicEventCondition);
                db.SaveChanges();

                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(Unauthorized());
            }
        }