public ActionResult create(SimpleNotification newSimpleNotification)
        {
            var newNotification = new Notification();

            if (ModelState.IsValid)
            {
                var repository = GetRepository<Notification>();
                var player = GetPlayer();

                //from form
                newNotification.Subject = newSimpleNotification.Subject;
                newNotification.Body = newSimpleNotification.Body;

                //set up notification
                newNotification.Created = DateTime.Now;
                newNotification.Updated = newNotification.Created;
                newNotification.Live = true;
                newNotification.Player = player;
                newNotification.NotificationType = (int)SiteHelper.NotificationType.BPL;

                repository.Add(newNotification);

                return Redirect("/notification");

            }
            return View(newSimpleNotification);
        }
 public NotificationModelView(IQueryable<Comment> Comments, Notification notification, Player CurrentPlayer)
 {
     body = notification.Body;
     subject = notification.Subject;
     CreatedAndBy = "Posted by " + notification.Player.Name + " @ " + notification.Created.ToString("dd MMMM yyyy @ hh:mm tt");
     //comments
     CommentModel = new CommentingViewModel(1, notification.Id, Comments, CurrentPlayer);
 }
Example #3
0
 public SimpleNotification(Notification n)
 {
     Subject = n.Subject;
     Body = n.Body;
 }