public async Task <int> StoreRegistration(BookRegistrationModel bookRegistrationModel) { BookRegistrationModel bookcred = new BookRegistrationModel() { Id = bookRegistrationModel.Id, FirstName = bookRegistrationModel.FirstName, LastName = bookRegistrationModel.LastName, Email = bookRegistrationModel.Email, Password = bookRegistrationModel.Password, }; var password = PasswordEncryption.EncodePasswordMd5(bookRegistrationModel.Password); bookcred.Password = password; var registeruser = this.userContext.StoreAccount.Add(bookcred); var result = this.userContext.SaveChanges(); var rest = await Task.Run(() => result); return(rest); }
public async Task <IActionResult> Register([FromBody] BookRegistrationModel bookRegistrationModel) { try { var result = await this.accountManager.StoreRegistration(bookRegistrationModel); if (result != null) { logger.LogInformation("Register details"); return(this.Ok(result)); } else { var jsonobj = new JsonError(); jsonobj.ErrorCode = 400; jsonobj.ErrorMessage = "Invalid Credentials"; return(BadRequest(jsonobj)); } } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <string> StoreRegistration(BookRegistrationModel bookRegistrationModel) { await this.bookAccount.StoreRegistration(bookRegistrationModel); return("Registration successful"); }