public static PunResponseModel MapToPun(this Pun pun) { return(new PunResponseModel() { Pun = pun.Content }); }
private static void EnterPun() { Console.WriteLine("---------------"); Console.Write("Name of pun? "); var name = Console.ReadLine(); Console.Write("Pun? "); var joke = Console.ReadLine(); var pun = new Pun { Title = name, Joke = joke }; _service.CreatePun(pun); }
private static void EditPun(int index) { Console.WriteLine("---------------"); Console.Write("Name of pun? "); var name = Console.ReadLine(); Console.Write("Pun? "); var joke = Console.ReadLine(); var pun = new Pun { PunID = index, Title = name, Joke = joke }; _service.UpdatePun(pun); }
/** [シングルトン]constructor */ private Network() { //room_list this.room_list = new System.Collections.Generic.Dictionary <string, RoomItem>(); //game_version this.game_version = "0.01"; //nick_name this.nick_name = "NickName"; //pun #if (USE_DEF_FEE_PUN) this.pun = new Pun(); #endif }
public async Task <ActionResult <Pun> > Create([FromBody] PunDto NewPun) { if (ModelState.IsValid) { var Pun = new Pun { Text = NewPun.Text, Score = 0 }; // Add the Pun to recieve its ID await _db.AddAsync(Pun); // Find the User first var User = await _db.Users.FirstOrDefaultAsync(u => u.Id == NewPun.UserId); if (User != null) { Pun.UserId = NewPun.UserId; // Pun.User = User; ToDo: Fix this } // Find the Tags foreach (var tag in NewPun.Tags) { var t = _db.Tags.FirstOrDefault(tg => tg.Text == tag); if (t != null) { var pt = new PunTag { PunId = Pun.PunId, Pun = Pun, TagId = t.TagId, Tag = t }; t.PunTags.Add(pt); Pun.PunTags.Add(pt); } } // Once we finish, let's save await _db.SaveChangesAsync(); return(CreatedAtAction(nameof(Get), new { Id = Pun.PunId }, Pun)); } return(BadRequest("Check Sent Data!")); }
public void UpdatePun(Pun pun) { throw new NotImplementedException(); }
public Pun UpdatePun(Pun pun) { return(SendDataToServer("http://localhost:49944/PunService.svc/Pun/" + pun.PunID, "PUT", pun)); }
public Pun CreatePun(Pun pun) { return(SendDataToServer("http://localhost:49944/PunService.svc/Puns", "POST", pun)); }
public void UpdatePun(Pun pun) { _client.EditPun(pun); }
public void CreatePun(Pun pun) { _client.CreatePun(pun); }
public void CreatePun(Pun pun) { _service.AddPun(pun); }
public void UpdatePun(Pun pun) { _service.UpdatePun(pun); }
public Pun CreatePun(Pun pun) { return(_service.AddPun(pun)); }
public Pun UpdatePun(string punID, Pun pun) { return(_service.UpdatePun(pun)); }