public async Task <ActionResult <IngridientType> > PostIngridientType(IngridientType ingridientType) { _context.IngridientTypes.Add(ingridientType); await _context.SaveChangesAsync(); return(CreatedAtAction("GetIngridientType", new { id = ingridientType.Id }, ingridientType)); }
public async Task <IActionResult> PutIngridientType(int id, IngridientType ingridientType) { if (id != ingridientType.Id) { return(BadRequest()); } _context.Entry(ingridientType).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!IngridientTypeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
private IEnumerable <Slice> GetAllSugestSlices(Pizza pizza, int pizzaRowStart, int pizzaColStart) { var result = new List <Slice>(); foreach (var sliceShape in _sliceShapes) { // Check size if (pizzaRowStart + sliceShape.RowEnd > pizza.Height || pizzaColStart + sliceShape.ColumnEnd > pizza.Width) { continue; } var sliceIngridients = new IngridientType[sliceShape.ColumnEnd][]; for (var col = 0; col < sliceShape.ColumnEnd; col++) { sliceIngridients[col] = new IngridientType[sliceShape.RowEnd]; for (var row = 0; row < sliceShape.RowEnd; row++) { sliceIngridients[col][row] = pizza[col + pizzaColStart, row + pizzaRowStart]; } } var sliceCoord = new Coords { ColumnStart = pizzaColStart, ColumnEnd = pizzaColStart + sliceShape.ColumnEnd - 1, RowStart = pizzaRowStart, RowEnd = pizzaRowStart + sliceShape.RowEnd - 1 }; result.Add(new Slice(sliceIngridients, sliceCoord)); } return(result); }
public static IngridientType[][] CreateIngridients(int cols, int rows) { var ingridients = new IngridientType[cols][]; for (var index = 0; index < cols; index++) { ingridients[index] = new IngridientType[rows]; } return(ingridients); }
private bool DoesPlayerDontHaveIngridient(IngridientType ingridient1, IngridientType ingridient2) { if (player.CurrentlyHeldIngridients.Count > 0) { foreach (Ingridient heldIngridient in player.CurrentlyHeldIngridients) { if (ingridient1 == heldIngridient.Type) { return(false); } } } return(ingridient1 == ingridient2); }
public Item(string name, float _volume, IngridientType type) : base(name) { Volume = _volume; TypeOfIngridient = type; }
private bool IngridientMatch(IngridientType ingridient1, IngridientType ingridient2) { return(ingridient1 == ingridient2); }