public IActionResult PutOpportunityStatus(int key, [FromBody] Models.Crm.OpportunityStatus newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (newItem == null || (newItem.Id != key))
                {
                    return(BadRequest());
                }

                this.OnOpportunityStatusUpdated(newItem);
                this.context.OpportunityStatuses.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.OpportunityStatuses.Where(i => i.Id == key);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
        public IActionResult Post([FromBody] Models.Crm.OpportunityStatus item)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                if (item == null)
                {
                    return(BadRequest());
                }

                this.OnOpportunityStatusCreated(item);
                this.context.OpportunityStatuses.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/Crm/OpportunityStatuses/{item.Id}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
 partial void OnOpportunityStatusUpdated(Models.Crm.OpportunityStatus item);