public IActionResult Post([FromBody] Models.Sortimat.Machine item)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnMachineCreated(item);
                this.context.Machines.Add(item);
                this.context.SaveChanges();

                return(Created($"odata/Sortimat/Machines/{item.MachineID}", item));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
        public IActionResult PutMachine(int key, [FromBody] Models.Sortimat.Machine newItem)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

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

                this.OnMachineUpdated(newItem);
                this.context.Machines.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Machines.Where(i => i.MachineID == key);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
 partial void OnMachineUpdated(Models.Sortimat.Machine item);
 partial void OnMachineDeleted(Models.Sortimat.Machine item);