Beispiel #1
0
        public async Task <IActionResult> Create([Bind("ProjectId,ProjectName")] ProjectManagementModel ProjectManagement)
        {
            if (ModelState.IsValid)
            {
                _context.Add(ProjectManagement);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Create)));
            }
            return(View(ProjectManagement));
        }
Beispiel #2
0
        public async Task <IActionResult> SignUp([Bind("Email,Password,ConfirmPassword")] registered_staff staff)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (_context.registered_staff.Any(info => info.Email == staff.Email))
                    {
                        ModelState.AddModelError("Email", "The email address you entered is already in use");
                        ViewData["Message"] = "Already a member? Log In";
                        return(View(staff));
                    }
                    else
                    {
                        _context.Add(staff);
                        await _context.SaveChanges <registered_staff>();

                        //var type = new staff_type(staff.StaffID);
                        _context.staff_type.Add(new staff_type(staff.StaffID));
                        await _context.SaveChanges <staff_type>();


                        return(View("RequiredInfo"));
                    }
                }
                else
                {
                    ViewData["Message"] = "Already a member? Log In";
                    return(View(staff));
                }
            }
            catch (Exception e)
            {
                return(Error());
            }
        }