public IActionResult Ayarlar() { var usersAndProfile = _usersAndBuyersService.GetByUserId(_userManager.GetUserId(User)); var buyerId = usersAndProfile.BuyerId; var buyer = _buyerService.GetById(buyerId); var profileSettingsViewModel = new ProfileSettingsViewModel { BuyerId = buyer.BuyerId, BuyerName = buyer.BuyerName, Adress = buyer.Adress, Email = buyer.Email, PhoneNumber = buyer.PhoneNumber, ProfileImageUrl = buyer.ProfileImageUrl }; return(View(profileSettingsViewModel)); }
public async Task <IActionResult> GirisYap(LoginModel model, string returnUrl = null) { returnUrl = returnUrl ?? "~/"; if (!ModelState.IsValid) { return(View(model)); } var user = await _userManager.FindByNameAsync(model.UserName); if (user == null) { ModelState.AddModelError("", "Böyle bir koleksiyoncu bulunamadı."); return(View(model)); } if (!await _userManager.IsEmailConfirmedAsync(user)) { ModelState.AddModelError("", "Bu hesap e-posta ile onaylanmamış."); return(View(model)); } if (!await _userManager.IsInRoleAsync(user, "Buyer")) { ModelState.AddModelError("", "Bu hesap satıcı hesabı değil!"); return(View(model)); } var result = await _signInManager.PasswordSignInAsync(model.UserName, model.Password, true, false); if (result.Succeeded) { var buyerId = _userAndBuyersService.GetByUserId(user.Id).BuyerId; var buyer = _buyerService.GetById(buyerId); buyer.LastLoginDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); _buyerService.Update(buyer); return(Redirect(returnUrl)); } ModelState.AddModelError("", "Kullanıcı adı veya parola yanlış!"); return(View(model)); }
public IActionResult Get(int id) { var data = _service.GetById(id); return(Ok(data)); }
private Payment PaymentProcess(OrderModel model) { Options options = new Options(); options.ApiKey = "sandbox-DUnDbJBwWO7mM3aOhQztq9blAQiDfmJ1"; options.SecretKey = "sandbox-tL0LazZd7Us7HP9XtsFhxAn7gSw13YKN"; options.BaseUrl = "https://sandbox-api.iyzipay.com"; CreatePaymentRequest request = new CreatePaymentRequest(); request.Locale = Locale.TR.ToString(); request.ConversationId = Guid.NewGuid().ToString(); request.Price = model.CartModel.TotalPrice().ToString().Split(",")[0];; request.PaidPrice = model.CartModel.TotalPrice().ToString().Split(",")[0];; request.Currency = Currency.TRY.ToString(); request.Installment = 1; request.BasketId = model.CartModel.CartId.ToString(); request.PaymentChannel = PaymentChannel.WEB.ToString(); request.PaymentGroup = PaymentGroup.PRODUCT.ToString(); PaymentCard paymentCard = new PaymentCard(); paymentCard.CardHolderName = model.CardName; paymentCard.CardNumber = model.CardNumber; paymentCard.ExpireMonth = model.ExpirationMonth; paymentCard.ExpireYear = model.ExpirationYear; paymentCard.Cvc = model.Cvv; paymentCard.RegisterCard = 0; request.PaymentCard = paymentCard; var kBuyer = _buyerService.GetById(_usersAndBuyersService.GetByUserId(_userManager.GetUserId(User)).BuyerId); Buyer buyer = new Buyer(); buyer.Id = model.BuyerId.ToString(); buyer.Name = model.FirstName; buyer.Surname = model.LastName; buyer.GsmNumber = model.Phone; buyer.Email = model.Email; buyer.IdentityNumber = "11111111111"; buyer.LastLoginDate = kBuyer.LastLoginDate; buyer.RegistrationDate = kBuyer.RegistrationDate; buyer.RegistrationAddress = kBuyer.Adress; buyer.Ip = _accessor.HttpContext.Connection.RemoteIpAddress.ToString(); buyer.City = model.City; buyer.Country = "Turkey"; buyer.ZipCode = model.ZipCode; request.Buyer = buyer; Address shippingAddress = new Address(); shippingAddress.ContactName = model.FirstName + " " + model.LastName; shippingAddress.City = model.City; shippingAddress.Country = "Turkey"; shippingAddress.Description = model.Address; shippingAddress.ZipCode = model.ZipCode; request.ShippingAddress = shippingAddress; Address billingAddress = new Address(); billingAddress.ContactName = model.FirstName + " " + model.LastName; billingAddress.City = model.City; billingAddress.Country = "Turkey"; billingAddress.Description = model.Address; billingAddress.ZipCode = model.ZipCode; request.BillingAddress = billingAddress; List <BasketItem> basketItems = new List <BasketItem>(); BasketItem basketItem; foreach (var item in model.CartModel.CartItems) { basketItem = new BasketItem(); basketItem.Id = item.ProductId.ToString(); basketItem.Name = item.Name; basketItem.Category1 = "Koleksiyonluk"; basketItem.ItemType = BasketItemType.PHYSICAL.ToString(); basketItem.Price = (item.Quantity * item.Price).ToString().Split(",")[0]; basketItems.Add(basketItem); } request.BasketItems = basketItems; return(Payment.Create(request, options)); }