Beispiel #1
0
        public static void Run(ModuleCollection[] collections)
        {
            // Load all compilation configs
            VSFullConfiguration[] configs = BuildStatics.GetVSFullConfigurations();
            RecipeTarget[]        recipes = new RecipeTarget[configs.Length];
            for (int i = 0; i < configs.Length; ++i)
            {
                recipes[i] = configs[i].AsRecipeTarget();
            }

            // Make sure all recipes are loaded
            foreach (ModuleCollection collection in collections)
            {
                collection.LoadModuleRecipes(recipes);
            }


            // Resolve all dependencies
            RecipeCollection.ResolveModuleDependencies(recipes, collections);


            // Create solution and project files
            VSSolution solution = new VSSolution(collections);

            solution.LoadProjects();
            VSSolutionIO.WriteAllDetails(solution, configs);
        }
Beispiel #2
0
        public IHttpActionResult Save(RecipeVm entity)
        {
            var entityToEdit = RecipeCollection.FirstOrDefault(x => x.Id == entity.Id);

            if (entityToEdit != null)
            {
                entityToEdit.Id              = entity.Id;
                entityToEdit.Calories        = entity.Calories;
                entityToEdit.Ingredients     = entity.Ingredients;
                entityToEdit.Portion         = entity.Portion;
                entityToEdit.PreparationMode = entity.PreparationMode;
                entityToEdit.Title           = entity.Title;

                if (entity.Ingredients.Any())
                {
                    entityToEdit.Ingredients.Clear();
                    foreach (var item in entity.Ingredients)
                    {
                        entityToEdit.Ingredients.Add(item);
                    }
                }
            }
            else
            {
                entity.Id = (RecipeCollection.Any()) ? RecipeCollection.Max(x => x.Id) + 1 : 1;
                RecipeCollection.Add(entity);
            }

            JsonResult.Status = true;
            JsonResult.Object = RecipeCollection;
            return(Ok(JsonResult));
        }
Beispiel #3
0
        public IHttpActionResult GetIngredientsByRecipeId(int id)
        {
            JsonResult.Status = true;
            var entity = RecipeCollection.Where(x => x.Id == id).FirstOrDefault();

            JsonResult.Object = entity.Ingredients;
            return(Ok(JsonResult));
        }
Beispiel #4
0
        public IHttpActionResult Delete(int id)
        {
            JsonResult.Status = true;
            var itemToRemove = RecipeCollection.Single(x => x.Id == id);

            RecipeCollection.Remove(itemToRemove);
            JsonResult.Object = RecipeCollection;
            return(Ok(JsonResult));
        }
Beispiel #5
0
    public static void Write(RecipeCollection collection, Recipe element)
    {
        if (element != null)
        {
            collection.recipes.Add(element);
        }

        JsonManager.Write(Path, collection);
    }
Beispiel #6
0
    private void Start()
    {
        uIController    = FindObjectOfType <UIController>();
        pauseMenu       = FindObjectOfType <PauseMenu>();
        currentCategory = CategoryType.Test1;
        playerInventory = FindObjectOfType <UI_PlayerInventory>();
        hotbarInventory = FindObjectOfType <UI_HotBar>();

        recipeCollection = RecipeManager.Read();
        itemCollection   = ItemManager.Read();

        isActive = false;

        uIController.togglableUIs.Add(gameObject);

        UpdateUI();
    }
Beispiel #7
0
    // Use this for initialization
    void Start()
    {
        stateManager = new StateManager();
        stateManager.StatusChanged += sm_OnStatusChanged;

        keyboardInput = new KeyboardInput();
        keyboardInput.CommandDetected += kd_OnCommandDetected;

        keywordDetector = this.GetComponent <KeywordDetector> ();
        keywordDetector.CommandDetected += kd_OnCommandDetected;

        collection = LoadRecipes();

        initializer = new BarInitializer();

        setupUI();
    }
        public async Task <ActionResult <ApiRecipeCollection> > PostRecipeCollection(ApiRecipeCollection apiRecipeCollection)
        {
            var currentUserId = _httpContextAccessor.HttpContext?.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;

            if (currentUserId != apiRecipeCollection.UserId)
            {
                return(Unauthorized());
            }

            var collection = new RecipeCollection
            {
                UserId      = apiRecipeCollection.UserId,
                Title       = apiRecipeCollection.Title,
                Description = apiRecipeCollection.Description,
                Visibility  = apiRecipeCollection.Visibility
            };

            _context.RecipeCollection.Add(collection);

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (RecipeCollectionExists(collection))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetRecipeCollection", new { id = apiRecipeCollection.UserId }, apiRecipeCollection));
        }
Beispiel #9
0
 public IHttpActionResult GetById(int id)
 {
     JsonResult.Status = true;
     JsonResult.Object = RecipeCollection.Where(x => x.Id == id).FirstOrDefault();
     return(Ok(JsonResult));
 }
Beispiel #10
0
 public Inventory()
 {
     _Ingredients = new IngredientCollection();
     _Recipes     = new RecipeCollection();
 }
 private bool RecipeCollectionExists(RecipeCollection c)
 {
     return(_context.RecipeCollection.Any(e => e.UserId == c.UserId && e.Title == c.Title));
 }
 private void init()
 {
     m_recipes = new RecipeCollection();
 }