Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        public ActionResult DeleteConfirmed(string id)
        {
            Coments coments = db.Coments.Find(id);

            db.Coments.Remove(coments);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Coments coments = await db.Comentss.FindAsync(id);

            db.Comentss.Remove(coments);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 5
0
        public Coments Read(Coments _coments)
        {
            Init("Read");

            object[] paramArr = new object[1];
            paramArr[0] = _coments;

            return(_coments = (Coments)_method.Invoke(_obj, paramArr));
        }
Exemplo n.º 6
0
        public void Delete(Coments _coments)
        {
            Init("Delete");

            object[] paramArr = new object[1];
            paramArr[0] = _coments;

            _method.Invoke(_obj, paramArr);
        }
Exemplo n.º 7
0
 public static void Loss(IFighter fighter, int roundNumber)
 {
     if (fighter.corner == "player")
     {
         fighter.DowngradeContracts();
         Console.WriteLine($"  Przegrana w {roundNumber} rundzie.");
         Console.WriteLine(Coments.Loss());
     }
 }
Exemplo n.º 8
0
        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();
        }
Exemplo n.º 9
0
        public void DeleteUser(long id)
        {
            Coments coments = Comentsepository.Get(id);

            Comentsepository.Remove(coments);
            Post post = GetPost(id);

            PostRepository.Remove(post);
            PostRepository.SaveChanges();
        }
Exemplo n.º 10
0
 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));
 }
Exemplo n.º 11
0
        public void Delete(int?id)
        {
            Coments coments = new Coments();

            if (id == coments.ID)
            {
                _internalUnitOfWork.ComentsRespository.Delete(coments);
                _internalUnitOfWork.Save();
            }
        }
Exemplo n.º 12
0
        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));
        }
Exemplo n.º 13
0
        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);
        }
Exemplo n.º 14
0
        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));
        }
Exemplo n.º 15
0
 public string AppDelete(int comentId)
 {
     try
     {
         Coments coments = _context.Coments.Find(comentId);
         _context.Coments.Remove(coments);
         _context.SaveChanges();
         return("Deleted");
     }
     catch
     {
         return("Error");
     }
 }
Exemplo n.º 16
0
        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));
        }
Exemplo n.º 17
0
        // 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));
        }
Exemplo n.º 18
0
        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));
        }
Exemplo n.º 19
0
        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);
            }
        }
Exemplo n.º 20
0
        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();
                }
            }
        }
Exemplo n.º 21
0
        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();
                }
            }
        }
Exemplo n.º 22
0
        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();
                }
            }
        }
Exemplo n.º 23
0
        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");
        }
Exemplo n.º 24
0
        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));
        }
Exemplo n.º 25
0
        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"));
        }
Exemplo n.º 26
0
        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));
        }
Exemplo n.º 27
0
        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");
            }
        }
Exemplo n.º 28
0
        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();
        }
Exemplo n.º 30
0
 public int Update(Coments pObjComent)
 {
     return(mObjComentsDAO.Update(pObjComent));
 }