Exemplo n.º 1
0
        public ActionResult Post([FromBody] BuyItem value)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            var item = _service.Add(value);

            return(CreatedAtAction("Get", new { id = item.Id }, item));
        }
Exemplo n.º 2
0
 public ActionResult Create(BuyViewModel buy)
 {
     if (!ModelState.IsValid)
     {
         ErrorNotification("Kayıt Eklenemedi!");
         return(RedirectToAction("Create"));
     }
     _buyService.Add(new Buy
     {
         //TODO:Alanlar buraya yazılacak
         //Örn:BrandName = brand.BrandName,
     });
     SuccessNotification("Kayıt Eklendi.");
     return(RedirectToAction("BuyIndex"));
 }
Exemplo n.º 3
0
        public ActionResult BuyGift(int id)
        {
            var loggedUserId   = Convert.ToInt32(GeneralHelpers.GetUserId());
            var userMail       = _userQueryableRepository.Table.AsNoTracking().FirstOrDefault(x => x.UserId == loggedUserId);
            var buyingGift     = _giftService.GetById(id);
            var remainingPoint = GeneralHelpers.GetRemainingPoint();

            var brand   = _giftQueryableRepository.Table.Include("Brand").AsNoTracking().FirstOrDefault(x => x.GiftId == id);
            var brandId = _brandQueryableRepository.Table.FirstOrDefault(x => x.BrandId == brand.BrandId);

            if (buyingGift.GiftPoint > remainingPoint)
            {
                ErrorNotification("Çok Üzgünüm:( Yeterli Miktarda BaPu'nuz Yok. Daha Fazla BaPu İçin Puan Kazan Ekranına Gidip Satış Girmeye Ne Dersiniz?");
                return(RedirectToAction("Index", "BuyUser"));
            }
            _buyService.Add(new Buy
            {
                GiftId     = buyingGift.GiftId,
                UserId     = Convert.ToInt32(GeneralHelpers.GetUserId()),
                BuyDate    = DateTime.Now,
                BuyAmount  = 1,
                BrandId    = brand.BrandId,
                IsApproved = true,
                BuyState   = BuyState.IncelemeBekliyor
            });
            var mailEnable = System.Configuration.ConfigurationManager.AppSettings["MailEnable"];

            if (mailEnable == "true")
            {
                var mail = MailHelper.SendMail(
                    $"<strong>{userMail.FirstName + " " + userMail.LastName}</strong> Kullanıcısının <strong>{brandId.BrandName + " " + buyingGift.Description}</strong> için Hediye İsteği var.<br/> Lütfen bayipuan.com üzerinde takip ediniz.",
                    $"*****@*****.**", "Yeni Bir Hediye İsteği Var!", true);
                if (mail)
                {
                    SuccessNotification("Mail Gönderildi");
                }
                else
                {
                    ErrorNotification("Mail Gönderilemedi!");
                }
            }

            SuccessNotification("Tebrikler! Hediye Talebiniz İletildi. Lütfen Talebinizin Durumunu Hediye Takip Ekranından Kontrol Ediniz");
            return(RedirectToAction("Index", "BuyUser"));
        }
Exemplo n.º 4
0
 public ActionResult Post([FromBody] ProductVM model)
 {
     return(Ok(
                _buyService.Add(model)));
 }