public async Task <IActionResult> PutAdjunct(int id, Adjunct adjunct) { if (id != adjunct.IngredientId) { return(BadRequest()); } _context.Entry(adjunct).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AdjunctExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public virtual bool Equals(Adjunct obj) { if (ReferenceEquals(null, obj)) { return(false); } if (ReferenceEquals(this, obj)) { return(true); } return(obj.id == id); }
public BreweryDb(string key) { _key = key; Adjunct = new Adjunct(_client, _baseAddress, _key); Brewery = new Brewery(_client, _baseAddress, _key); Yeast = new Yeast(_client, _baseAddress, _key); Style = new Style(_client, _baseAddress, _key); SocialSite = new SocialSite(_client, _baseAddress, _key); Ingredient = new Ingredient(_client, _baseAddress, _key); Hop = new Hop(_client, _baseAddress, _key); BeerCategory = new BeerCategory(_client, _baseAddress, _key); Beer = new Beer(_client, _baseAddress, _key); Feature = new Feature(_client, _baseAddress, _key); Fermentable = new Fermentable(_client, _baseAddress, _key); }
public async Task <ActionResult <Adjunct> > PostAdjunct(Adjunct adjunct) { _context.Adjunct.Add(adjunct); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (AdjunctExists(adjunct.IngredientId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetAdjunct", new { id = adjunct.IngredientId }, adjunct)); }
public virtual bool Equals(Adjunct obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; return obj.id == id; }