public IActionResult Register(int Category, string ShopName, string fullname, string Mobile, string UserName, string Password, string RePassword) { RequestRegisterUserDto requestRegisterUser = new RequestRegisterUserDto() { Email = UserName + "@msn.com", FullName = fullname, Password = Password, ConfirmPassword = RePassword, UserName = UserName, Role = "Seller" }; var resultRegister = _registerUserService.Execute(requestRegisterUser); if (resultRegister.Data.IdentityResult.Succeeded == true) { RequestAddNewSellerDto request = new RequestAddNewSellerDto() { UserName = UserName, CategoryId = Category, Mobile = Mobile, ShopName = ShopName, UserId = resultRegister.Data.UserId, }; return(Json(_sellerService.Add(request))); } else { return(Json(resultRegister.Message)); } }
public IActionResult Add(Seller seller) { var result = _sellerService.Add(seller); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public async Task <IActionResult> KayitOl(RegisterModel model) { if (!ModelState.IsValid) { return(View(model)); } var user = new ApplicationUser { UserName = model.NameAndSurname, Email = model.EmailAdress }; var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callBackUrl = Url.Action("ConfirmEmail", "Hesap", new { userId = user.Id, token = code }); await _emailSender.SendEmailAsync(model.EmailAdress, "Hesabınızı Onaylayınız.", $"Lütfen email hesabınızı onaylamak için linke <a href='http://localhost:44301{callBackUrl}'>tıklayınız.</a>"); var seller = new Seller { NameAndSurname = model.NameAndSurname, EmailAdress = model.EmailAdress, City = model.City, Adress = model.Adress, PhoneNumber = model.PhoneNumber, Rate = 0, VerifiedSeller = false }; _sellerService.Add(seller); var sellerId = seller.SellerId; _userAndSellersService.Add(new UsersAndSellers { SellerId = sellerId, UserId = user.Id }); var addToRole = await _userManager.AddToRoleAsync(user, "Seller"); if (addToRole.Succeeded) { return(RedirectToAction("GirisYap", "Hesap")); } } ModelState.AddModelError("", "Bilinmeyen hata oluştu lütfen tekrar deneyiniz."); return(View(model)); }
public ActionResult Create(SellerViewModel seller) { if (!ModelState.IsValid) { ErrorNotification("Kayıt Eklenemedi!"); return(RedirectToAction("Create")); } _sellerService.Add(new Seller { //TODO:Alanlar buraya yazılacak //Örn:BrandName = brand.BrandName, }); SuccessNotification("Kayıt Eklendi."); return(RedirectToAction("SellerIndex")); }
public ActionResult Create(SellerViewModel seller) { if (!ModelState.IsValid) { ErrorNotification("Kayıt Eklenemedi!"); return(RedirectToAction("Create")); } _sellerService.Add(new Seller { CityId = seller.CityId, SellerCode = seller.SellerCode, SellerName = seller.SellerName, UserTypeId = seller.UserTypeId }); SuccessNotification("Kayıt Eklendi."); return(RedirectToAction("SellerIndex")); }
public IActionResult Post([FromBody] Seller model) { return(Ok(_sellerService.Add(model))); }
public async Task <ApiResponse> Post([FromBody] SellerRequest SellerRequest) { var battery = _mapper.Map <SellerResponse>(await _SellerService.Add(_mapper.Map <SellerEntity>(SellerRequest))); return(new ApiResponse("Ok", battery, 200)); }