コード例 #1
0
        public ActionResult Create([Bind(Include = "id,title,createdTime,published,createdByUser_id,language_id")] Categories category) //[Bind(Include = "id,title,previd,createdTime,published,createdByUser_id,language_id")]
        {
            //TODO при создании указать пользователя который создал эту тему

            if (ModelState.IsValid)
            {
                category.createdTime = DateTime.Now;

                repository.Add(category);
                return(RedirectToAction("Index"));
            }

            ViewBag.language_id      = new SelectList(_languagesHandler.All(), "id", "title", category.language_id);
            ViewBag.createdByUser_id = new SelectList(_usergroupsHandler.All(), "id", "name", category.createdByUser_Id);
            return(View(category));
        }