Example #1
0
        public ActionResult Create(string Data, int TopicID)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            try
            {
                Message msg = new Message();
                msg.Data        = Data;
                msg.EntryDate   = DateTime.Now;
                msg.DeveloperID = _dataModel.Developers.Single(d => d.UserName == User.Identity.Name).DeveloperID;
                msg.TopicID     = TopicID;
                _dataModel.AddToMessages(msg);
                _dataModel.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }