public Coments Read(Coments _coments) { ConfConnComm(); using (_conection) { _conection.Open(); using (_command) { _command.Connection = _conection; _command.CommandText = string.Format("SELECT * FROM Coments WHERE ID = {0}", _coments.ID); using (_reader = _command.ExecuteReader()) { _reader.Read(); _coments.ID = (int)_reader["ID"]; _coments.Coment = (string)_reader["Coment"]; _coments.Rating = (int)_reader["Rating"]; _coments.ID_Film = (int)_reader["ID_Film"]; } _command.ExecuteNonQuery(); } } return(_coments); }
public async Task <IActionResult> Edit(int id, [Bind("ComentId,BoatId,CustomerId,Coment")] Coments coments) { if (id != coments.ComentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(coments); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ComentsExists(coments.ComentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(coments)); }
public ActionResult DeleteConfirmed(string id) { Coments coments = db.Coments.Find(id); db.Coments.Remove(coments); db.SaveChanges(); return(RedirectToAction("Index")); }
public async Task <ActionResult> DeleteConfirmed(int id) { Coments coments = await db.Comentss.FindAsync(id); db.Comentss.Remove(coments); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public Coments Read(Coments _coments) { Init("Read"); object[] paramArr = new object[1]; paramArr[0] = _coments; return(_coments = (Coments)_method.Invoke(_obj, paramArr)); }
public void Delete(Coments _coments) { Init("Delete"); object[] paramArr = new object[1]; paramArr[0] = _coments; _method.Invoke(_obj, paramArr); }
public static void Loss(IFighter fighter, int roundNumber) { if (fighter.corner == "player") { fighter.DowngradeContracts(); Console.WriteLine($" Przegrana w {roundNumber} rundzie."); Console.WriteLine(Coments.Loss()); } }
public void AddComents(ComentsViewModel coments) { Coments c = new Coments(); c.Description = coments.Description; c.PostsID = coments.PostsID; c.AspNetUsersId = coments.AspNetUsersId; _internalUnitOfWork.ComentsRespository.Insert(c); _internalUnitOfWork.Save(); }
public void DeleteUser(long id) { Coments coments = Comentsepository.Get(id); Comentsepository.Remove(coments); Post post = GetPost(id); PostRepository.Remove(post); PostRepository.SaveChanges(); }
public ActionResult Edit([Bind(Include = "comentario,id_user,nombreMarker")] Coments coments) { if (ModelState.IsValid) { db.Entry(coments).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(coments)); }
public void Delete(int?id) { Coments coments = new Coments(); if (id == coments.ID) { _internalUnitOfWork.ComentsRespository.Delete(coments); _internalUnitOfWork.Save(); } }
public ActionResult Create([Bind(Include = "comentario,id_user,nombreMarker")] Coments coments) { if (ModelState.IsValid) { db.Coments.Add(coments); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(coments)); }
public void CreateBLL(string _coment, int _rating, int _idFilm) { Coments comments = new Coments(); ComentsBLL combll = new ComentsBLL(); comments.Coment = _coment; comments.Rating = _rating; comments.ID_Film = _idFilm; combll.Create(comments); }
public async Task <IActionResult> Create([Bind("ComentId,BoatId,CustomerId,Coment")] Coments coments) { if (ModelState.IsValid) { _context.Add(coments); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(coments)); }
public string AppDelete(int comentId) { try { Coments coments = _context.Coments.Find(comentId); _context.Coments.Remove(coments); _context.SaveChanges(); return("Deleted"); } catch { return("Error"); } }
public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Coments coments = await db.Comentss.FindAsync(id); if (coments == null) { return(HttpNotFound()); } return(View(coments)); }
// GET: Coments/Delete/5 public ActionResult Delete(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Coments coments = db.Coments.Find(id); if (coments == null) { return(HttpNotFound()); } return(View(coments)); }
public AcceptedResult EditUser(int?id) { PostVievModel model = new PostVievModel(); if (id.HasValue && id != 0) { Post postEntity = postService.GetPost(id.Value); Coments comentsEntity = comentsService.GetComents(id.Value); model.UserName = postEntity.UserName; model.UserPost = postEntity.UserPost; } return(PartialView("_EditPost", model)); }
public static void Winn(IFighter fighter, IFighter directRival, int roundNumber) { if (fighter.corner == "player") { fighter.UpgradeContracts(); Thread.Sleep(1000); Console.WriteLine($" Wygrana w {roundNumber} rundzie."); Console.WriteLine(Coments.Winn()); Console.WriteLine("\n -- W nagrodę odberz 3 dodatkowe punkty by ulepszyć swojego zawodnika. --"); Console.WriteLine(" -- Użyj dowolnego klawisza, aby odebrać zasłużone punkty. --"); Console.ReadKey(); Rivals.UpgradeRivals(fighter, directRival); PointAward.UpgradeFighter(fighter); } }
public void Delete(Coments _coments) { ConfConnComm(); using (_conection) { _conection.Open(); using (_command) { _command.Connection = _conection; _command.CommandText = string.Format("DELETE FROM Coments WHERE ID = {0}", _coments.ID); _command.ExecuteNonQuery(); } } }
public void Create(Coments _coments) { ConfConnComm(); using (_conection) { _conection.Open(); using (_command) { _command.Connection = _conection; _command.CommandText = string.Format("INSERT INTO Coments (Coment, Rating, ID_Film) VALUES ('{0}',{1},{2})", _coments.Coment, _coments.Rating, _coments.ID_Film); _command.ExecuteNonQuery(); } } }
public void Update(Coments _coments) { ConfConnComm(); using (_conection) { _conection.Open(); using (_command) { _command.Connection = _conection; _command.CommandText = string.Format("UPDATE Coments SET Coment = '{0}', Rating = {1}, ID_Film = {2} WHERE ID = {3}", _coments.Coment, _coments.Rating, _coments.ID_Film, _coments.ID); _command.ExecuteNonQuery(); } } }
public string EnviarComentario(string usuarioRecibido, string comentarioRecibido, string nombreMarkerRecibido) { Coments cm = new Coments(); cm.comentario = comentarioRecibido; cm.id_user = usuarioRecibido; cm.nombreMarker = nombreMarkerRecibido; db.Coments.Add(cm); db.SaveChanges(); // var id_mark = db.Marker.Where(x => x.nombre == nombreMarkerRecibido).Select(s => s.id_marker).SingleOrDefault(); var comentariosUnSoloMarker = db.Coments.Where(x => x.nombreMarker == nombreMarkerRecibido).Select(s => s.comentario).ToList(); ViewBag.comentariosPorMarker = comentariosUnSoloMarker; return("OK"); }
public IActionResult Index() { List <PostVievModel> model = new List <PostVievModel>(); postService.GetPost().ToList().ForEach(p => { Coments coments = comentsService.GetComents(p.Id); PostVievModel post = new PostVievModel { Id = p.Id, UserName = $"{p}", // UserPost = post.UserPost }; model.Add(post); }); return(View(model)); }
public async Task <ActionResult> CommentsMethod(Coments coments) { if (ModelState.IsValid) { using (WebAppDbContext db = new WebAppDbContext()) { db.Comentss.Add(new Coments { FirstName = coments.FirstName, LastName = coments.LastName, Subject = coments.Subject }); await db.SaveChangesAsync(); } } else { ModelState.AddModelError("", "Не правильно введен фидбек"); } ViewBag.message = "Спасибо за отзыв"; return(View("Index")); }
public ActionResult EditPost(PostVievModel model) { Post postEntity = postService.GetPost(model.Id); postEntity.UserName = model.UserName; postEntity.ModData = DateTime.UtcNow; postEntity.IPAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString(); Coments comentsEntity = comentsService.GetComents(model.Id); comentsEntity.User = model.UserName; comentsEntity.Text = model.UserPost; comentsEntity.ModData = DateTime.UtcNow; comentsEntity.IPAddress = Request.HttpContext.Connection.RemoteIpAddress.ToString(); postEntity.Coments = comentsEntity; postService.UpdatePost(postEntity); if (postEntity.Id > 0) { return(RedirectToAction("index")); } return(View(model)); }
public string AppCreate(string json) { try { var inputJObject = JObject.Parse(json); Coments coments = new Coments() { CustomerId = Convert.ToInt32(inputJObject["customerId"]), BoatId = Convert.ToInt32(inputJObject["boatId"]), Coment = inputJObject["coment"].ToString(), ComentId = _context.Coments.Max(m => m.ComentId) + 1 }; _context.Coments.Add(coments); _context.SaveChanges(); return("ComentAdded"); } catch { return("Error"); } }
public List <Coments> ReadAll() { List <Coments> coment = new List <Coments>(); ConfConnComm(); using (_conection) { _conection.Open(); using (_command) { _command.Connection = _conection; _command.CommandText = string.Format("SELECT * FROM Coments"); using (_reader = _command.ExecuteReader()) { while (_reader.Read()) { Coments _coments = new Coments(); _coments.ID = (int)_reader["ID"]; _coments.Coment = (string)_reader["Coment"]; _coments.Rating = (int)_reader["Rating"]; _coments.ID_Film = (int)_reader["ID_Film"]; coment.Add(_coments); } } _command.ExecuteNonQuery(); } } return(coment); }
public void GetFightVerdict(RoundVerdict roundVerdict, Queue <Fighter> rivalsQueue, IFighter player) { if (roundVerdict.WinPlayersRounds > roundVerdict.WinRivalsRounds) { IFighter directRival = rivalsQueue.First(); rivalsQueue.Dequeue(); player.UpgradeContracts(); if (rivalsQueue.Count >= 1) { Console.WriteLine(Coments.Winn()); Console.WriteLine($"\n -- Już tylko {rivalsQueue.Count} zawodnik/ów na drodze do Pasa KSW. --"); Console.WriteLine(" -- W nagrodę odberz 3 dodatkowe punkty, by ulepszyć swojego zawodnika. --"); Console.ReadKey(); Rivals.UpgradeRivals(player, directRival); PointAward.UpgradeFighter(player); } else { Console.WriteLine("\n -- To była już ostatnia walka w drodze na szczyty KSW. -- "); Console.WriteLine(" -- Bez dwóch zdań, to właśnie Ty jesteś mistrzem.-- "); Console.WriteLine(" -- Pozostaje odebrać mistrzowski pas. -- "); } } else if (roundVerdict.WinPlayersRounds == roundVerdict.WinRivalsRounds) { Console.WriteLine(" -- Remis, aby rozstrzygnąc kto jest lepszy, musisz stoczyć tę walkę jeszcze raz. --"); } else { Console.WriteLine(" -- Niestety przegrałeś walkę na punkty. Tracisz kontrakt. Pasy KSW zdobywają mistrzowie, więc w drodze na szczyt czeka Cię rewanż. --"); player.DowngradeContracts(); } Console.WriteLine(" -- Użyj dowolnego klawisza by przejść dalej. --"); Console.ReadKey(); }
public int Update(Coments pObjComent) { return(mObjComentsDAO.Update(pObjComent)); }