Esempio n. 1
0
 //
 // GET: /Message/Create
 public ActionResult Create(int Receiver = 0)
 {
     var message = new Message();
     if (Receiver != 0)
     {
         UserProfile rec = db.UserProfiles.SingleOrDefault(u => u.UserProfileId == Receiver);
         message.Reciever = rec.UserName;
         return View(message);
     }
     return View();
 }
Esempio n. 2
0
        public ActionResult Details(Message message)
        {
            if (ModelState.IsValid)
            {
                message.Sender = Membership.GetUser().UserName;
                message.TimeSent = DateTime.Now.ToString();
                message.Starred = false;
                message.Trashed = false;
                db.Messages.Add(message);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(message);
        }
Esempio n. 3
0
        //
        // GET: /Message/Reply
        public ActionResult Reply(string Sender, string Reciever, string Subject)
        {
            var message = new Message();
            if (Reciever != null || Reciever != "")
            {
                //UserProfile rec = db.UserProfiles.SingleOrDefault(u => u.UserProfileId == Receiver);

                //ViewBag["parameterName"] = Request["parameterName"];

                //ViewBag[Reciever] = Request.Params[Reciever];
                //ViewBag[Sender] = Request.Params[Sender];
                //ViewBag[Subject] = Request.Params[Subject];

                message.Reciever = Reciever;
                message.Sender = Sender;
                message.Subject = Subject;
                return View(message);
            }
            return View();
        }
Esempio n. 4
0
        public ActionResult Reply(Message message)
        {
            // Console.WriteLine(ViewBag.Sender);
            // Console.WriteLine(message.Sender);
            // Console.WriteLine(Body);
            //var message = new Message();
            if (message != null)
            {
                message.Sender = Membership.GetUser().UserName;
                message.TimeSent = DateTime.Now.ToString();
                message.Starred = false;
                message.Trashed = false;
                db.Messages.Add(message);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(message);
        }
Esempio n. 5
0
 public ActionResult Edit(Message message)
 {
     if (ModelState.IsValid)
     {
         db.Entry(message).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(message);
 }