コード例 #1
0
        public IActionResult Create(string listId)
        {
            UserStoryViewModel userStoryViewModel = new UserStoryViewModel();

            userStoryViewModel.Content = "";
            userStoryViewModel.ID      = Guid.NewGuid().ToString("N");
            userStoryViewModel.Point   = 0;
            userStoryViewModel.ListID  = listId;
            var assigntoSelectList = _context.Set <UserEntity>().ToList().Select(a => new SelectListItem
            {
                Text  = a.NickName,
                Value = a.Id
            });

            userStoryViewModel.AssignToList = assigntoSelectList;

            var selectList = StoryStatusList.GetStatusList(_context).OrderBy(t => t.SortCode).Select(a => new SelectListItem
            {
                Text  = a.Text,
                Value = a.Code
            });

            userStoryViewModel.StatusList = selectList;
            return(PartialView(userStoryViewModel));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Name,Order")] ProjectEntity project)
        {
            if (ModelState.IsValid)
            {
                project.CreateTime     = DateTime.Now;
                project.LastModifyTime = DateTime.Now;
                UserEntity usere = _context.Set <UserEntity>().SingleOrDefault(t => t.Account == HttpContext.User.Identity.Name);
                project.CreatorUserId    = usere.Id;
                project.LastModifyUserId = project.CreatorUserId;
                project.Id = Guid.NewGuid().ToString("N");
                _context.Add(project);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(project));
        }