public IActionResult StudentRegistration(Student s) { if (s == null) { return(BadRequest("Check Student data please")); } if (_db.GetStudentByMail(s.Mail) != null || _db.GetInstructorByMail(s.Mail) != null) { return(BadRequest("Mail is Exists Try another one")); } if (ModelState.IsValid) { Student Std = _db.AddStudent(s); return(Ok(Std)); } else { return(BadRequest("Values Are not ok")); } }
public async Task <ActionResult <ResponseWithData <Student> > > SignUpStd(Student s) { // var response = new ResponseWithData<SignUp.response>(); if (await CheckMail(s.Mail)) { return(Ok(s.Mail)); } var user = new ApplicationUser() { Email = s.Mail, UserName = s.Fname + s.Lname }; var result = await _userManager.CreateAsync(user, s.Password); s.Token = _db.GetToken(); _db.AddStudent(s); if (result.Succeeded == false) { return(BadRequest("Some thing went wrong")); } return(Ok(s)); }