public async Task <IActionResult> Post([FromBody] Entertainer item) { var itemToCreate = new Entertainer { City = item.City, BusinessName = item.BusinessName, FirstName = item.FirstName, LastName = item.LastName, Country = item.Country, Description = item.Description, Email = item.Email, Phone = item.Phone, PhotoUrl = item.PhotoUrl, State = item.State, Street = item.Street, Website = item.Website, Zip = item.Zip }; context.Entertainer.Add(itemToCreate); await context.SaveChangesAsync(); return(CreatedAtAction(nameof(Get), new { id = itemToCreate.Id }, null)); }
public ActionResult Create([Bind(Include = "id,Username,Email,Password,FirstName,LastName,Street,Town,City,PhoneNumber,IsMagician,IsClown,IsBalloonAnimals,IsPettingZoo,IsCakes,IsCatering,IsFacePainting,IsJuggling,IsDJ,IsPartyGames,IsBouncyCastle,IsPuppets,IsHennaTattoos,IsHairBraiding,IsOther, CustomerId")] Entertainer entertainer) { if (ModelState.IsValid) { Customer cust = new Customer(); cust.City = entertainer.City; cust.Email = entertainer.Email; cust.FirstName = entertainer.FirstName; cust.LastName = entertainer.LastName; cust.Username = entertainer.Username; cust.Password = entertainer.Password; cust.Street = entertainer.Street; cust.Town = entertainer.Town; cust.PhoneNumber = entertainer.PhoneNumber; db.Customer.Add(cust); db.SaveChanges(); entertainer.CustomerId = cust.id; db.Entertainer.Add(entertainer); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(entertainer)); }
public async Task <IActionResult> Put(int id, [FromBody] Entertainer itemToUpdate) { var existingItem = await context.Entertainer.SingleOrDefaultAsync((System.Linq.Expressions.Expression <System.Func <Entertainer, bool> >)(i => i.Id == id)); if (existingItem == null) { return(NotFound(new { Message = $"Item with id {id} not found" })); } existingItem.City = itemToUpdate.City; existingItem.BusinessName = itemToUpdate.BusinessName; existingItem.FirstName = itemToUpdate.FirstName; existingItem.LastName = itemToUpdate.LastName; existingItem.Country = itemToUpdate.Country; existingItem.Description = itemToUpdate.Description; existingItem.Email = itemToUpdate.Email; existingItem.Phone = itemToUpdate.Phone; existingItem.PhotoUrl = itemToUpdate.PhotoUrl; existingItem.State = itemToUpdate.State; existingItem.Street = itemToUpdate.Street; existingItem.Website = itemToUpdate.Website; existingItem.Zip = itemToUpdate.Zip; existingItem.State = itemToUpdate.State; this.context.Entertainer.Update((Entertainer)existingItem); await this.context.SaveChangesAsync(); return(Ok(existingItem)); }
public ActionResult DeleteConfirmed(int id) { Entertainer entertainer = db.Entertainer.Find(id); db.Entertainer.Remove(entertainer); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,Username,Email,Password,FirstName,LastName,Street,Town,City,PhoneNumber,IsMagician,IsClown,IsBalloonAnimals,IsPettingZoo,IsCakes,IsCatering,IsFacePainting,IsJuggling,IsDJ,IsPartyGames,IsBouncyCastle,IsPuppets,IsHennaTattoos,IsHairBraiding,IsOther")] Entertainer entertainer) { if (ModelState.IsValid) { db.Entry(entertainer).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(entertainer)); }
// ,IsMagician,IsClown,IsBalloonAnimals,IsPettingZoo,IsCakes,IsCatering,IsFacePainting,IsJuggling,IsDJ,IsPartyGames,IsBouncyCastle,IsPuppets,IsHennaTattoos,IsHairBraiding,IsOther // GET: Entertainer/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Entertainer entertainer = db.Entertainer.Find(id); if (entertainer == null) { return(HttpNotFound()); } return(View(entertainer)); }
public static bool SameType(Entertainer first, Entertainer second) { if ((int)first <= 1 && (int)second <= 1) { return(true); } else if ((int)first >= 2 && (int)second >= 2) { return(true); } else { return(false); } }
public EmployeeCostume Register(AssetManagerLoader loader, Entertainer entertainer) { Array.Resize(ref entertainer.costumes, entertainer.costumes.Length + 1); EmployeeCostume costume = Build(loader); entertainer.costumes[entertainer.costumes.Length - 1] = costume; String id = costume.name; loader.AddUnregisterHandler(() => { entertainer.costumes = entertainer.costumes.Where((source, index) => !source.name.Equals(id)).ToArray(); }); return(entertainer.costumes[entertainer.costumes.Length - 1]); }
public static string ToText(Entertainer selection) { switch (selection) { case Entertainer.Clown: return("clown"); case Entertainer.Lecturer: return("lecturer"); case Entertainer.Priest: return("priest"); case Entertainer.Singer: return("singer"); default: return("wat?"); } }
private string generateBackground() { //TODO need a method to resolve conflicts between things selected in background and class and race (optimize) string background = ""; int randomNumber = NumberGen.gen(18); if (randomNumber == 0) { background = "Acolyte"; characterBackground = new Acolyte(); } else if (randomNumber == 1) { background = "Charlatan"; characterBackground = new Charlatan(); } else if (randomNumber == 2) { background = "Criminal"; characterBackground = new Criminal(); } else if (randomNumber == 3) { background = "Entertainer"; characterBackground = new Entertainer(); } else if (randomNumber == 4) { background = "Folk Hero"; characterBackground = new FolkHero(); } else if (randomNumber == 5) { background = "Entertainer (Gladiator)"; characterBackground = new Gladiator(); } else if (randomNumber == 6) { background = "Guild Artisan"; characterBackground = new GuildArtisan(); } else if (randomNumber == 7) { background = "Guild Artisan (Guild Merchant)"; characterBackground = new GuildMerchant(); } else if (randomNumber == 8) { background = "Hermit"; characterBackground = new Hermit(); } else if (randomNumber == 9) { background = "Knight"; characterBackground = new Knight(); } else if (randomNumber == 10) { background = "Noble"; characterBackground = new Noble(); } else if (randomNumber == 11) { background = "Outlander"; characterBackground = new Outlander(); } else if (randomNumber == 12) { background = "Pirate"; characterBackground = new Pirate(); } else if (randomNumber == 13) { background = "Sage"; characterBackground = new Sage(); } else if (randomNumber == 14) { background = "Sailor"; characterBackground = new Sailor(); } else if (randomNumber == 15) { background = "Soldier"; characterBackground = new Soldier(); } else if (randomNumber == 16) { background = "Spy"; characterBackground = new Spy(); } else if (randomNumber == 17) { background = "Urchin"; characterBackground = new Urchin(); } return(background); }