private MongoCollection <UserRegisteration> CreateUser(UserRegisteration user, MongoDatabase mongoDatabase) { MongoCollection <UserRegisteration> userregister = mongoDatabase.GetCollection <UserRegisteration>("UserRegisteration"); userregister.Insert(user); return(userregister); }
public IHttpActionResult Register([FromBody] UserInfo userInfo) { bool result = false; var message = string.Format("Operation failed, please check your email and password"); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } //db.UserInfos.Add(UserInfo); //db.SaveChanges(); IUserRegisteration userRegObj = new UserRegisteration(); result = userRegObj.register(userInfo); if (!result) { HttpError err = new HttpError(message); throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound, err)); } //return CreatedAtRoute("DefaultApi", new { id = userInfo.ID }, userInfo); return(StatusCode(HttpStatusCode.OK)); }
protected void registerUser_Click(object sender, EventArgs e) { UserLogin usr = UserLogin_S.CheckUserByApartmentBuilding(apartmentList.SelectedValue, "Faculty Housing"); if (usr == null) { UserRegisteration regObj = new UserRegisteration(); regObj.Apartment = apartmentList.SelectedValue; regObj.Building = "Faculty Housing"; regObj.ContactNo = contactNo.Value; regObj.Email = email.Text; bool stc = User_Registration.InsertRequest(regObj); if (stc == true) { msg.Text = "Registered! We will send you an email."; } else { msg.Text = "Your request is being processed."; } } else { msg.Text = "Already Registered!"; } email.Text = ""; contactNo.Value = ""; }
public ActionResult SendEmail(UserRegisteration reg) { var message = EmailTemplate("WelcomeEmail"); message = message.Replace("@ViewBag.Name", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(reg.C_FirstName)); //Sends email MessageServices.SendEmail(reg.C_EmailID, "Welcome to Continuous Integration!", message); return(View("EmailSent")); }
public void SendEmail() { UserRegisteration userRegistrations = new UserRegisteration() { C_FirstName = "Krutika", C_EmailID = "*****@*****.**" }; var viewResult = accountController.SendEmail(userRegistrations) as ViewResult; Assert.AreEqual("EmailSent", viewResult.ViewName); }
public void Create() { var userRegistration = new UserRegisteration { C_FirstName = "Krutika", C_LastName = "Khatavkar", C_EmailID = "*****@*****.**", C_Password = "******", C_CnfPassword = "******" }; var redirectToResult = userController.Create(userRegistration) as RedirectToRouteResult; Assert.AreEqual("SendEmail", redirectToResult.RouteValues["action"]); Assert.AreEqual("Account", redirectToResult.RouteValues["controller"]); }
public ActionResult CreateDoctors(UserRegisteration user, HttpPostedFileBase SecurityImage) { MongoDatabase mongoDatabase = database(); string imgPath; var ms = new MemoryStream(); var rowno = ReadUserRegisterationTable(database()).FindAll().Count(); SecurityImage.InputStream.CopyTo(ms); user.SecurityImange = ms.ToArray(); user.DoctorId = "Doc" + rowno.ToString("D4"); var saveduser = CreateUser(user, mongoDatabase); this.AddToastMessage("Create Doctor", "Create Doctor Sucessfull", ToastType.Info); return(RedirectToAction("ListDoctors", "Admin")); }
public ActionResult CreateDoctors(UserRegisteration user, HttpPostedFileBase SecurityImage) { MongoDatabase mongoDatabase = database(); string imgPath; SecurityImage.SaveAs("G:\\files\\" + SecurityImage.FileName); imgPath = "G:\\files\\" + SecurityImage.FileName; if (System.IO.File.Exists(imgPath)) { byte[] content = imgStream(imgPath); user.SecurityImange = content; var saveduser = CreateUser(user, mongoDatabase); } return(RedirectToAction("ListDoctors", "Admin")); }
public ActionResult Login(MultiModel obj) { UserRegisteration user = db.UserRegisterations.FirstOrDefault( x => String.Compare(x.Email, obj.Login.Username, StringComparison.Ordinal) == 0); if (user != null) { if (String.Compare(user.Password, obj.Login.Password, StringComparison.Ordinal) == 0) { Session["date"] = user.RegisterDate; Session["name"] = user.Name; Session["email"] = user.Email; Session["id"] = user.UserId; System.Web.Security.FormsAuthentication.SetAuthCookie(obj.Login.Username, false); } } return(RedirectToAction("Index")); }
public async Task <IResponseDTO> Register([FromBody] UserRegisteration request) { var authResponse = await _identityService.RegisterAsync(request.FullName, request.UserName, request.Email, request.Password, request.UserType, request.PhoneNumber); if (authResponse.Code != 200) { _response.Data = authResponse; _response.Message = authResponse.Message; _response.Code = authResponse.Code; } else { _response.Data = authResponse; _response.Message = authResponse.Message; _response.Code = authResponse.Code; } return(_response); }
public async virtual Task <IActionResult> Register(UserRegisteration user) { if (string.IsNullOrEmpty(user.username) || string.IsNullOrEmpty(user.password)) { return(BadRequest("username or password can not be empty")); } user.username = user.username.ToLower(); if (await _authRepo.UserExists(user.username)) { return(BadRequest("User is alredy exists")); } var userToCreate = _mapper.Map <User>(user); var returnUser = _mapper.Map <UserForDetailed>(userToCreate); var createdUser = await _authRepo.Register(userToCreate, user.password); return(CreatedAtRoute("GetUser", new { Controller = "Users", id = createdUser.Id }, returnUser)); }
public ActionResult Create(UserRegisteration register) { try { if (ModelState.IsValid) { DBHelper da = new DBHelper(); da.SaveUserDetails(register); return(RedirectToAction("SendEmail", "Account", register)); } else { //this will return view with validation msg return(View("Index", register)); } } catch (Exception e) { throw new ApplicationException("Plz fill out the data" + e); } }
private static MongoCollection <UserRegisteration> UpdateDoctorDetails(MongoDatabase mongoDatabase, string ID, UserRegisteration model) { MongoCollection <UserRegisteration> userRegisteration = mongoDatabase.GetCollection <UserRegisteration>("UserRegisteration"); var query = Query.EQ("_id", ObjectId.Parse(ID)); var update = Update.Set("Email", model.Email).Set("Phone", model.Phone).Set("Password", model.Password).Set("Department", model.Department).Set("Designation", model.Designation); userRegisteration.Update(query, update); return(userRegisteration); }
public ActionResult EditDoctor(UserRegisteration val, string docId) { UpdateDoctorDetails(database(), docId, val); this.AddToastMessage("Update Doctor", "Update Doctor Information Sucessfully", ToastType.Info); return(RedirectToAction("ListDoctors", "Admin")); }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { UserLogin confirmObj = new UserLogin(); confirmObj.Building = GridView1.SelectedRow.Cells[0].Text; confirmObj.Apartment = GridView1.SelectedRow.Cells[1].Text; confirmObj.EMail = GridView1.SelectedRow.Cells[2].Text; if (GridView1.SelectedRow.Cells[3].Text != " ") { confirmObj.Mobile = GridView1.SelectedRow.Cells[3].Text; } confirmObj.UserName = confirmObj.Apartment + "-" + confirmObj.Building; MD5 md5 = new MD5CryptoServiceProvider(); confirmObj.Password = DateTime.Now.ToString("ddmmyyyyHHmm"); string pass = confirmObj.Password; md5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(confirmObj.Password)); byte[] result = md5.Hash; StringBuilder strBuilder = new StringBuilder(); for (int i = 0; i < result.Length; i++) { //change it into 2 hexadecimal digits //for each byte strBuilder.Append(result[i].ToString("x2")); } confirmObj.Password = strBuilder.ToString(); bool stc = UserLogin_S.InsertUser(confirmObj); if (stc == true) { UserLogin ul = UserLogin_S.Loging(confirmObj.UserName); if (ul != null) { UserMapping map = new UserMapping(); map.Apartment = confirmObj.Apartment; map.Building = confirmObj.Building; map.UserId = ul.UserId; bool stst = UserMapping_S.UpdateUserIdinMap(map); if (stst == true) { SendingMails.SendRegistrationMail(confirmObj, pass); UserRegisteration regObj = new UserRegisteration(); regObj.Building = GridView1.SelectedRow.Cells[0].Text; regObj.Apartment = GridView1.SelectedRow.Cells[1].Text; regObj.Status = "aprooved"; bool stc2 = User_Registration.UpdateRequest(regObj); if (stc2 == true) { msg.Text = "Registered + Mail sent"; } } else { msg.Text = "Cannot update mapping table"; } } else { msg.Text = "Something went wrong in-between"; } GridView1.DataBind(); } else { msg.Text = "Cannot register"; } }