public async Task <IActionResult> Create([Bind("Id,Title,NoteLocation,CourseId,CreateDate,PublishDate,IsPublish")] NoteInfo noteInfo)
        {
            if (ModelState.IsValid)
            {
                noteInfoService.Add(noteInfo);
                await unitOfWork.SaveAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CourseId"] = new SelectList(courseService.GetAll(), "Id", "Title", noteInfo.CourseId);
            return(View(noteInfo));
        }
Exemplo n.º 2
0
        public ActionResult Add(NoteInfo ni)
        {
            try
            {
                // TODO: Add insert logic here
                ni.SubTime    = DateTime.Now;
                ni.DelFlag    = 0;
                ni.UserInfoId = (HttpContext.Session["userInfo"] as UserInfo).Id;
                noteInfoService.Add(ni);

                return(Content("ok"));
            }
            catch
            {
                return(Content("添加失败"));
            }
        }