Exemplo n.º 1
0
        public ActionResult Delete(int id)
        {
            var service = new MeaningService();
            var model   = service.GetMeaningById(id);

            return(View(model));
        }
Exemplo n.º 2
0
        //Get Edit
        public ActionResult MeaningEdit(int id)
        {
            var service = new MeaningService();
            var detail  = service.GetMeaningById(id);

            return(View(detail));
        }
Exemplo n.º 3
0
        public ActionResult Edit(int id, MeaningListItem model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            if (model.MeaningId != id)
            {
                ModelState.AddModelError("", "Word is null");
                return(View(model));
            }

            var service = new MeaningService();



            if (service.UpdateMeaning(model))
            {
                TempData["SaveResult"] = "Your note was updated.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your meaning could not be updated.");
            return(View(model));
        }
Exemplo n.º 4
0
        // GET: Meaning
        public ActionResult Index()
        {
            var service = new MeaningService();
            var model   = service.GetAllMeanings();

            return(View(model));
        }
Exemplo n.º 5
0
        public ActionResult DeleteMeaningWId(int id)
        {
            var service = new MeaningService();

            service.DeleteMeaning(id);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
        public ActionResult DeleteMeaning(int id)
        {
            var service         = new MeaningService();
            var meaningToDelete = service.GetMeaningById(id);

            return(View(meaningToDelete));
        }
Exemplo n.º 7
0
        public ActionResult EditMeaning(MeaningListItem oldMeaning)
        {
            var service = new MeaningService();
            var update  = service.UpdateMeaning(oldMeaning);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 8
0
        public ActionResult EditMeaning(int id)
        {
            var service    = new MeaningService();
            var oldMeaning = service.GetMeaningById(id);

            return(View(oldMeaning));
        }
Exemplo n.º 9
0
        public ActionResult CreateRating(int id, RatingCreate ratingModel)
        {
            var serviceRating  = new RatingService();
            var serviceMeaning = new MeaningService();
            var meaning        = serviceMeaning.GetMeaningById(id);

            serviceRating.CreateRating(id, ratingModel);

            return(RedirectToAction("DisplayComments", "Word", new { id = meaning.MeaningId }));
        }
Exemplo n.º 10
0
        public ActionResult CreateRating(int id)
        {
            var service = new MeaningService();
            var model   = service.GetMeaningById(id);
            var rating  = new RatingCreate()
            {
                MeaningId = model.MeaningId,
            };

            return(View(rating));
        }
Exemplo n.º 11
0
        public ActionResult Create(MeaningCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var service = new MeaningService();

            //service.CreateMeaning(model);
            return(RedirectToAction("index"));
        }
Exemplo n.º 12
0
        public ActionResult DeleteMeaning(int id)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            var service = new MeaningService();

            service.DeleteMeaning(id);

            TempData["SaveResult"] = "Your note was deleted";

            return(RedirectToAction("Index"));
        }
Exemplo n.º 13
0
        public ActionResult CreateMeaning(int id, MeaningCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }


            //if(is null)
            // { return View(model); }

            var serviceMeaning = new MeaningService();
            var serviceWord    = new WordService();
            var word           = serviceWord.GetWordById(id);


            serviceMeaning.CreateMeaning(word, model);
            return(RedirectToAction("Details", "Word", new { id = word.WordId }));
        }