Esempio n. 1
0
        public ActionResult Save(Announcement announcement)
        {
            try
            {
                var announcementRepository = new AnnouncementRepository();
                //     announcement.userName = HttpContext.User.Identity.Name;
                if (HttpContext.Session != null)
                {
                    announcement.UserId = HttpContext.Session["UserId"] as int?;
                }

                announcement.CreateDate   = DateTime.Now.Date;
                announcement.LastModified = DateTime.Now.Date;
                announcementRepository.Save(announcement);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }