Exemple #1
0
 public VMNotification(VMLeaveFeedback f)
 {
     UserId           = f.UserId;
     TimeStamp        = f.TimeStamp;
     IsSeen           = f.IsSeen;
     Title            = f.Title;
     Description      = f.Description;
     URL              = f.URL;
     Sender           = f.Sender;
     NotificationType = NotificationType.PortfolioFeedback;
     SenderId         = f.SenderId;
 }
 public VMNotification(VMLeaveFeedback f)
 {
     UserId = f.UserId;
     TimeStamp = f.TimeStamp;
     IsSeen = f.IsSeen;
     Title = f.Title;
     Description = f.Description;
     URL = f.URL;
     Sender = f.Sender;
     NotificationType = NotificationType.PortfolioFeedback;
     SenderId = f.SenderId;
 }
 public ActionResult TargetedNotification(VMLeaveFeedback v)
 {
     if (ModelState.IsValid)
     {
         DAL.addNotification(Translator.NotificationFromVMNotification(new VMNotification(v)), v.UserId);
         return RedirectToAction("AllUsers", "Admin");
     }
     else
     {
         return View();
     }
 }
        public ActionResult TargetedNotification()
        {
            int targetId = int.Parse(RouteData.Values["id"].ToString());
            User user = DAL.retrieveUser(WebSecurity.CurrentUserId);

            VMLeaveFeedback v = new VMLeaveFeedback
            {
                IsSeen = false,
                Title = "Admin " + user.FirstName + " " + user.LastName + " sent you a message",
                Description = "",
                URL = null,
                Sender = "Admin " + user.FirstName + " " + user.LastName,
                TimeStamp = DateTime.UtcNow,
                UserId = targetId,
                ProjectName = null,
                Receiver = DAL.retrieveUser(targetId).FirstName + " " + DAL.retrieveUser(targetId).LastName,
                PortfolioId = 0,
                SenderId = user.Id,
            };
            return View(model: v);
        }
        public ActionResult LeaveFeedback(VMLeaveFeedback v)
        {
            if (ModelState.IsValid)
            {
                Notification test = Translator.NotificationFromVMNotification(new VMNotification(v));
                DAL.addNotification(Translator.NotificationFromVMNotification(new VMNotification(v)), v.UserId);

                return RedirectToAction("Portfolio", "Portfolio", new { id = v.PortfolioId });
            }
            else
            {
                return View();
            }
        }
 public ActionResult LeaveFeedback(int? senderId, int? portfolioId)
 {
     if (senderId == null)
     {
         return View("../User/Login");
     }
     else if (portfolioId == null)
     {
         return View("../Home/Index");
     }
     else
     {
         VMLeaveFeedback v = new VMLeaveFeedback{
         IsSeen = false,
         Title = DAL.retrieveUser(WebSecurity.CurrentUserId).FirstName + " " + DAL.retrieveUser(WebSecurity.CurrentUserId).LastName + " has critiqued your " + DAL.retrievePortfolio((int)portfolioId).Title,
         Description = "",
         URL = "~/Portfolio/Portfolio/" + portfolioId,
         Sender = DAL.retrieveUser(WebSecurity.CurrentUserId).FirstName + " " +  DAL.retrieveUser(WebSecurity.CurrentUserId).LastName,
         TimeStamp = DateTime.UtcNow,
         UserId = DAL.retrievePortfolio((int)portfolioId).UserId,
         ProjectName = DAL.retrievePortfolio((int)portfolioId).Title,
         Receiver = DAL.retrieveUser(DAL.retrievePortfolio((int)portfolioId).UserId).FirstName + " " + DAL.retrieveUser(DAL.retrievePortfolio((int)portfolioId).UserId).LastName,
         PortfolioId = (int)portfolioId,
         SenderId = senderId
     };
         return View(model: v);
     }
 }