コード例 #1
0
        public ActionResult Create(Content content)
        {
            ViewBag.Categories = categoryDao.GetAll();
            if (!ModelState.IsValid)
            {
                return(View(content));
            }
            content.CreatedDate = DateTime.Now;
            content.CreatedBy   = (Session[Constants.USER_SESSION] as UserLogin).UserID.ToString();
            string result = contentDao.Add(content);

            if (result == COMMON_CONSTANTS.ADD_SUCCESS)
            {
                return(RedirectToAction("Index", "Content"));
            }
            else
            {
                return(RedirectToAction("Index", "Error"));
            }
        }