public IHttpActionResult PutTypeOfCard(int id, TypeOfCard typeOfCard) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != typeOfCard.TypeOfCardID) { return(BadRequest()); } db.Entry(typeOfCard).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TypeOfCardExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public CardTypeModel GetCardType(TypeOfCard typeOfCard) { switch (typeOfCard) { case TypeOfCard.Adventure: return(GetCardTypeModel(AdventureId, AdventureName)); case TypeOfCard.Character: return(GetCardTypeModel(CharacterId, CharacterName)); case TypeOfCard.Creature: return(GetCardTypeModel(CreatureId, CreatureName)); case TypeOfCard.Item: return(GetCardTypeModel(ItemId, ItemName)); case TypeOfCard.Lesson: return(GetCardTypeModel(LessonId, LessonName)); case TypeOfCard.Location: return(GetCardTypeModel(LocationId, LocationName)); case TypeOfCard.Match: return(GetCardTypeModel(MatchId, MatchName)); case TypeOfCard.Spell: return(GetCardTypeModel(SpellId, SpellName)); default: throw new Exception("Card type not recognized."); } }
public override void Apply(TypeOfCard typeOfCard) { _typeOfCard = typeOfCard; _typeSetter = new CardTypeSetter(_type(this)); _typeSetter.Initialize(ChangeTracker); _typeOfCard.AddModifier(_typeSetter); }
public Card(int number, string firstName, string lastName, double bill, int bonusBill, TypeOfCard type) { this.number = number; client = new Client(firstName, lastName); this.bills.Add(bill); this.bonusBill = bonusBill; this.type = type; AddCardToList(); }
public IHttpActionResult GetTypeOfCard(int id) { TypeOfCard typeOfCard = db.TypeOfCards.Find(id); if (typeOfCard == null) { return(NotFound()); } return(Ok(typeOfCard)); }
public override void Apply(TypeOfCard typeOfCard) { _typeOfCard = typeOfCard; var type = _typeOfCard.Value.Change(subTypes: _landSubtype); _cardTypeModifier = new CardTypeSetter(type); _cardTypeModifier.Initialize(ChangeTracker); _typeOfCard.AddModifier(_cardTypeModifier); }
public IHttpActionResult PostTypeOfCard(TypeOfCard typeOfCard) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TypeOfCards.Add(typeOfCard); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = typeOfCard.TypeOfCardID }, typeOfCard)); }
public IHttpActionResult DeleteTypeOfCard(int id) { TypeOfCard typeOfCard = db.TypeOfCards.Find(id); if (typeOfCard == null) { return(NotFound()); } db.TypeOfCards.Remove(typeOfCard); db.SaveChanges(); return(Ok(typeOfCard)); }
public Card(TypeOfCard typeOfCard, CardValue cardValue) { TypeOfCard = typeOfCard; NameOfCard = cardValue; }