コード例 #1
0
        public async Task <UrunResponse> AddAsync(UrunRequest urunRequest)
        {
            var urun = new Urun()
            {
                KategoriId = urunRequest.KategoriId,
                UrunAdi    = urunRequest.UrunAdi,
                Aciklama   = urunRequest.Aciklama,
                Fiyat      = urunRequest.Fiyat
            };
            var sonuc = await _urunRepository.AddAsync(urun);

            var urunResponse = new UrunResponse();

            if (sonuc == 0)
            {
                urunResponse.Message = "Yeni Kayıt Eklenemedi.";
                urunResponse.Urunler = null;
            }
            else
            {
                urunResponse.Message = "Yeni Kayıt Ekleme işlemi başarılı.";
                urunResponse.Urunler = null;
            }
            return(urunResponse);
        }
コード例 #2
0
 public async Task <UrunResponse> Post([FromBody] UrunRequest urunRequest)
 {
     return(await _urunBusiness.AddAsync(urunRequest));
 }