Example #1
0
        public async Task <IActionResult> Create([Bind("ID,UserNum,UserName,UserSex,PassWord,UserClass,UserAcademy,UserGroup,UserPhone,QQ,WeChat,UserEmail,UserPositionType,UserPosition,UserStatus,UserMaster,UserApprentice,UserLable")] User user)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var checkUserNum = await _context.Users.SingleOrDefaultAsync(m => m.UserNum == user.UserNum);

                    if (checkUserNum == null)
                    {
                        user.University   = "北京大学";
                        user.Professional = "信息与计算科学";
                        user.WorkType     = "工作";
                        user.WorkPlace    = "北京XXX公司";
                        user.WorkPosition = "前端开发工程师";
                        user.Message      = "高度发达放大飞洒似的士大夫首发式地方似的似的发射点发射点发发生发生地方是大师傅大师傅的非法上访的地方第三方的对方的感受地方公共给微软而体贴温柔额热热热二如题如题热热额二人台让人头人二人让他认为人人。而同为额。";


                        user.AddDate = DateTime.Now.Date;
                        _context.Add(user);
                        await _context.SaveChangesAsync();

                        return(RedirectToRoute(new { controller = "RegistrationManage", action = "Delete", area = "Adm", id = user.ID }));
                    }
                    else
                    {
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(View(user));
        }
        public async Task <IActionResult> Create([Bind("ID,Title,ContentUrl,AnnouncedUser,AnnouncedDate")] Notice notice)
        {
            if (ModelState.IsValid)
            {
                _context.Add(notice);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(notice));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("ID,UserNum,UserName,UserSex,UserAcademy,UserClass,UserPhone,QQ,WeChat,UserEmail,UserLable")] Registration registration, string[] InterstAnrry)
        {
            if (ModelState.IsValid)
            {
                if (InterstAnrry != null)
                {
                    for (int i = 0; i < InterstAnrry.Length; i++)
                    {
                        registration.Interest += InterstAnrry[i] + "|";
                    }
                }
                _context.Add(registration);
                await _context.SaveChangesAsync();

                return(RedirectToRoute(new { controller = "Register", action = "Welcome", area = "", Information = "您的注册信息已提交,请耐心等待管理员审核!", RegisterName = registration.UserName }));
            }
            return(View(registration));
        }