public CriticReview UpdateCriticReview(CriticReview existing, CriticReview criticReview)
        {
            _repositoryWrapper.CriticReview.UpdateCriticReview(existing, criticReview);
            // _logger.WriteInfo($"Updated user with id: {user.Id}.");

            return(criticReview);
        }
        public CriticReview AddCriticReview(CriticReview criticReview)
        {
            _repositoryWrapper.CriticReview.AddCriticReview(criticReview);
            //_logger.WriteInfo($"Added user with id: {user.Id}.");

            return(criticReview);
        }
Esempio n. 3
0
        public DistinctReviewList <CriticReview> GetCriticReviewData(string category)
        {
            MySqlCommand command = new MySqlCommand("SELECT * FROM Review WHERE isCriticReview AND productType = \"" + category + "\"", connection);

            DistinctReviewList <CriticReview> result = new DistinctReviewList <CriticReview>();
            MySqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                object[] tempResult = new object[reader.FieldCount];
                reader.GetValues(tempResult);

                CriticReview row = new CriticReview((int)tempResult[0], reader.GetBoolean(10), (float)tempResult[4], (float)tempResult[14],
                                                    reader.GetDateTime(1),
                                                    (string)tempResult[13], //title
                                                    (string)tempResult[12], //url
                                                    (string)tempResult[11], //category
                                                    (string)tempResult[3],  //content
                                                    (string)tempResult[6]   //author
                                                    );
                if (!reader.IsDBNull(7) && !reader.IsDBNull(8))
                {
                    row.positiveReception = (int)tempResult[7];
                    row.negativeReception = (int)tempResult[8];
                }

                result.Add(row);
            }

            reader.Close();

            return(result);
        }
Esempio n. 4
0
        //[Authorize(Roles = RoleName.CanManage)]
        public ActionResult DeleteConfirmed(int id)
        {
            CriticReview criticReview = db.CriticReviews.Find(id);

            db.CriticReviews.Remove(criticReview);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Post([FromBody] CriticReview newItem)
        {
            if (newItem is null)
            {
                return(BadRequest());
            }

            var item = _criticReviewService.AddCriticReview(newItem);

            return(Ok(item));
        }
        void ReleaseDesignerOutlets()
        {
            if (Cast != null)
            {
                Cast.Dispose();
                Cast = null;
            }

            if (Mpaa != null)
            {
                Mpaa.Dispose();
                Mpaa = null;
            }

            if (RunningTime != null)
            {
                RunningTime.Dispose();
                RunningTime = null;
            }

            if (ReleaseDate != null)
            {
                ReleaseDate.Dispose();
                ReleaseDate = null;
            }

            if (Synopsis != null)
            {
                Synopsis.Dispose();
                Synopsis = null;
            }

            if (RottenIndicator != null)
            {
                RottenIndicator.Dispose();
                RottenIndicator = null;
            }

            if (CriticReview != null)
            {
                CriticReview.Dispose();
                CriticReview = null;
            }

            if (Director != null)
            {
                Director.Dispose();
                Director = null;
            }
        }
Esempio n. 7
0
        // GET: CriticReviews/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CriticReview criticReview = db.CriticReviews.Include(p => p.Game).Where(p => p.CriticReviewId == id).FirstOrDefault();

            if (criticReview == null)
            {
                return(HttpNotFound());
            }
            return(View(criticReview));
        }
Esempio n. 8
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            CriticReview criticReview = db.CriticReviews.Find(id);

            if (criticReview == null)
            {
                return(HttpNotFound());
            }
            return(View(criticReview));
        }
Esempio n. 9
0
        public ActionResult Edit(CriticReviewViewModel criticReviewVM)
        {
            if (ModelState.IsValid)
            {
                CriticReview criticReview = db.CriticReviews.Find(criticReviewVM.CriticReviewId);
                criticReview.CriticFullName  = criticReviewVM.CriticFullName;
                criticReview.CriticUpdatedOn = DateTime.Now;
                criticReview.CriticScore     = criticReviewVM.CriticScore;
                criticReview.CriticRev       = criticReviewVM.CriticRev;
                db.Entry(criticReview).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.PostId = new SelectList(db.Games, "Id", "Title", criticReviewVM.GameId);

            return(View(criticReviewVM));
        }
Esempio n. 10
0
 public ActionResult Create(CriticReviewViewModel criticReviewVM)
 {
     if (ModelState.IsValid)
     {
         CriticReview criticReview = new CriticReview();
         criticReview.GameId          = criticReviewVM.GameId;
         criticReview.CriticFullName  = UserHelper.GetUserName(db.Users, User.Identity);
         criticReview.CriticCreatedOn = DateTime.Now;
         criticReview.CriticUpdatedOn = DateTime.Now;
         criticReview.CriticScore     = criticReviewVM.CriticScore;
         criticReview.CriticRev       = criticReviewVM.CriticRev;
         db.CriticReviews.Add(criticReview);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PostId = new SelectList(db.Games, "Id", "Title", criticReviewVM.GameId);
     return(View());
 }
        public ActionResult Put([FromBody] CriticReview changedItem)
        {
            if (changedItem is null)
            {
                return(BadRequest());
            }

            var existingItem = _criticReviewService.AsQueryable()
                               .Where(x => x.Id == changedItem.Id)
                               .FirstOrDefault();

            if (existingItem is null)
            {
                return(NotFound());
            }

            var item = _criticReviewService.UpdateCriticReview(existingItem, changedItem);

            return(Ok(item));
        }
 public void RemoveCriticReview(CriticReview criticReview)
 {
     _repositoryWrapper.CriticReview.RemoveCriticReview(criticReview);
     // _logger.WriteInfo($"Removed user with id: {user.Id}.");
 }