public async Task <IActionResult> Register(RegisterModel model) { if (!ModelState.IsValid) { return(View()); } var user = await _userManager.FindByNameAsync(model.UserName); if (user != null) { return(View("Success")); } user = new User { UserName = model.UserName, Email = model.UserName, }; var result = await _userManager.CreateAsync(user, model.Password); if (!result.Succeeded) { foreach (var error in result.Errors) { ModelState.AddModelError(string.Empty, error.Description); } return(View()); } var token = await _userManager.GenerateEmailConfirmationTokenAsync(user); var confirmationEmail = Url.Action("ConfirmEmailAddress", "Account", new { token = token, email = user.Email }, Request.Scheme); _emailMessageService.AddOrUpdate(new EmailMessage { From = string.Empty, To = user.Email, Subject = "Confirmation Email", Body = string.Format("Confirmation Email: {0}", confirmationEmail), }); return(View("Success")); }
public async Task <IActionResult> Upload(UploadFile model) { var fileEntry = new FileEntry { Name = model.Name, Description = model.Description, Size = model.FormFile.Length, UploadedTime = DateTime.Now, FileName = model.FormFile.FileName, }; _fileEntryService.AddOrUpdate(fileEntry); using (var stream = new MemoryStream()) { await model.FormFile.CopyToAsync(stream); _fileManager.Create(fileEntry, stream); } _fileEntryService.AddOrUpdate(fileEntry); return(View()); }
public async Task <IActionResult> AddPhoneNumber(AddPhoneNumberViewModel model) { if (!ModelState.IsValid) { return(View(model)); } // Generate the token and send it var user = await GetCurrentUserAsync(); var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, model.PhoneNumber); _smsMessageService.AddOrUpdate(new SmsMessage { PhoneNumber = model.PhoneNumber, Message = "Your security code is: " + code }); return(RedirectToAction(nameof(VerifyPhoneNumber), new { PhoneNumber = model.PhoneNumber })); }
public void Handle(AddUpdateProductCommand command) { _productService.AddOrUpdate(command.Product); }
public Task <Book> AddOrUpdate([FromBody] Book entity) { return(_crudService.AddOrUpdate(entity)); }
public Task <Customer> AddOrUpdate([FromBody] Customer entity) { return(_crudService.AddOrUpdate(entity)); }
public void Handle(AddOrUpdateEntityCommand <TEntity> command) { _crudService.AddOrUpdate(command.Entity); }
public Task <RentOrder> AddOrUpdate([FromBody] RentOrder entity) { return(_crudService.AddOrUpdate(entity)); }