Ejemplo n.º 1
0
        public ActionResult Rate(RateOrganizerHangoutViewModel model)
        {
            
                // Grab Host Id and HangoutId from model
                // Put rating values in new model "RateHangoutViewModel"
                // _hangoutRepository.Rate(model);
              
                
                var userInfo = User.Identity.GetUserId();
                model.AttendeeId = userInfo;
                _hangoutRepository.RateOrganizerAndHangout(model);

                return RedirectToAction("MyHangouts");

            // If we got this far, something failed, redisplay form
        }
Ejemplo n.º 2
0
        public void RateOrganizerAndHangout(RateOrganizerHangoutViewModel model)
        {
            OrganizerRating orgRating = new OrganizerRating
            {
                OrganizerId = model.UserId,
                AttendeeId = model.AttendeeId,
                Rating = model.OrganizerRating,
                HangoutId = model.Id
            };

            //HangoutRating hangoutRating = new HangoutRating
            //{
            //    AttendeeId = model.AttendeeId,
            //    HangoutId = model.Id,
            //    Rating = model.HangoutRating
            //};

            OrganizerRatings_db.OrganizerRatings.InsertOnSubmit(orgRating);
            //HangoutRatings_db.HangoutRatings.InsertOnSubmit(hangoutRating);

            try
            {
                OrganizerRatings_db.SubmitChanges();
                //HangoutRatings_db.SubmitChanges();

            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                // Make some adjustments.
                // ...
                // Try again.
                OrganizerRatings_db.SubmitChanges();
                //HangoutRatings_db.SubmitChanges();

            }
        }
Ejemplo n.º 3
0
 public ActionResult Rate(int id)
 {
     var item = _hangoutRepository.GetRateHangoutById(id);
     var model = new RateOrganizerHangoutViewModel
     {
         Id = item.Id,
         Date = item.Date,
         Description = item.Description,
         Name = item.Name,
         HostUser = item.HostUser,
         UserId  = item.HostUser.UserId,
         Location = item.Location,
         OpenSpots = item.OpenSpots,
         GenderRatio = item.GenderRatio,
         AttendingList = item.AttendingList,
         StartTime = item.StartTime,
         EndTime = item.EndTime,
         ImageContent = item.ImageContent,
         ImageMimeType = item.ImageMimeType
     };
     return View(model);
 }