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

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

                this.OnShiftCreated(item);
                this.context.Shifts.Add(item);
                this.context.SaveChanges();

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

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

                this.OnShiftUpdated(newItem);
                this.context.Shifts.Update(newItem);
                this.context.SaveChanges();

                var itemToReturn = this.context.Shifts.Where(i => i.ShiftID == key);
                return(new ObjectResult(SingleResult.Create(itemToReturn)));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(BadRequest(ModelState));
            }
        }
 partial void OnShiftUpdated(Models.Sortimat.Shift item);
 partial void OnShiftDeleted(Models.Sortimat.Shift item);