コード例 #1
0
        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());
        }
コード例 #2
0
ファイル: Adjunct.cs プロジェクト: jrauber/GH1429
 public virtual bool Equals(Adjunct obj)
 {
     if (ReferenceEquals(null, obj))
     {
         return(false);
     }
     if (ReferenceEquals(this, obj))
     {
         return(true);
     }
     return(obj.id == id);
 }
コード例 #3
0
ファイル: BreweryDb.cs プロジェクト: n3wc/api.brewerydb
 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);
 }
コード例 #4
0
        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));
        }
コード例 #5
0
ファイル: Adjunct.cs プロジェクト: marchlud/nhibernate-core
		public virtual bool Equals(Adjunct obj)
		{
			if (ReferenceEquals(null, obj)) return false;
			if (ReferenceEquals(this, obj)) return true;
			return obj.id == id;
		}