public async Task <DataModels.Type> DeleteType(int typeId)
        {
            DataModels.Type dbEntry = dbContext.Types.Find(typeId);
            if (dbEntry == null)
            {
                throw new InvalidOperationException("Type not found");
            }
            dbContext.Types.Remove(dbEntry);

            await dbContext.SaveChangesAsync();

            return(dbEntry);
        }
        public async Task <int> SaveType(DataModels.Type type)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type), "Parameter is null");
            }
            if (type.Id == 0)
            {
                dbContext.Types.Add(type);
            }
            else
            {
                DataModels.Type dbEntry = dbContext.Types.Find(type.Id);
                if (dbEntry == null)
                {
                    throw new InvalidOperationException("Type not found");
                }
                dbEntry.Name = type.Name;
            }

            await dbContext.SaveChangesAsync();

            return(type.Id);
        }