public ActionResult Create(RatingCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }


            var service = CreateRaterService();

            if (service.CreateRating(model))
            {
                return(RedirectToAction("Index"));
            }

            var baseId      = Guid.Parse(User.Identity.GetUserId());
            var baseService = new BaseService(baseId);
            var baseList    = baseService.GetBasesByUserID(baseId);

            var raterId      = Guid.Parse(User.Identity.GetUserId());
            var raterService = new RaterService(raterId);
            var raterList    = raterService.GetRatersByUserID(raterId);


            ViewBag.BaseID  = new SelectList(baseList, "BaseID", "BaseName");
            ViewBag.RaterID = new SelectList(raterList, "RaterID", "DisplayInfo");


            return(View(model));
        }
Exemplo n.º 2
0
        // GET: Rater
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new RaterService(userId);
            var model   = service.GetRatersByUserID(userId);

            return(View(model));
        }
        //GET BaseRating Create
        public ActionResult Create()
        {
            var baseId      = Guid.Parse(User.Identity.GetUserId());
            var baseService = new BaseService(baseId);
            var baseList    = baseService.GetBasesByUserID(baseId);

            var raterId      = Guid.Parse(User.Identity.GetUserId());
            var raterService = new RaterService(raterId);
            var raterList    = raterService.GetRatersByUserID(raterId);


            ViewBag.BaseID  = new SelectList(baseList, "BaseID", "BaseName");
            ViewBag.RaterID = new SelectList(raterList, "RaterID", "DisplayInfo");


            return(View());
        }