public void Post([FromBody] PhotographerInfo photographer) { var code = this.dataAccesLayer.AddUserVerification(photographer.UserName); var emailSender = new SendVerificationCodeEmail(new NetworkCredential("*****@*****.**", "kanchhiking2018")); emailSender.Send(photographer.Email, code.ToString()); }
public Status Post([FromBody] UserInfo user) { var emailValidator = new EmailValidation(); if (!emailValidator.IsValidEmail(user.Email)) { return new Status { StatusCode = 2002, IsOk = false, Message = "Email is not valid" } } ; if (!this.usersDataAccessLayer.IsValidUserName(user.UserName)) { return new Status { StatusCode = 2001, IsOk = false, Message = "UserName is already existing" } } ; this.usersDataAccessLayer.AddUser(user); var code = this.usersDataAccessLayer.AddUserVerification(user.UserName); var emailSender = new SendVerificationCodeEmail(new NetworkCredential("*****@*****.**", "kanchhiking2018")); emailSender.Send(user.Email, code.ToString()); return(new Status { StatusCode = 1000, IsOk = true, Message = "Your account is crated." }); }