public async Task <bool> Update(KategoriDto KategoriDto)
        {
            var stringContent = new StringContent(JsonConvert.SerializeObject(KategoriDto), Encoding.UTF8, "application/json");

            var response = await _httpclient.PutAsync("kategoriler", stringContent);

            if (response.IsSuccessStatusCode)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <KategoriDto> AddAsync(KategoriDto KategoriDto)
        {
            var stringContent = new StringContent(JsonConvert.SerializeObject(KategoriDto), Encoding.UTF8, "application/json");

            var response = await _httpclient.PostAsync("kategoriler", stringContent);

            if (response.IsSuccessStatusCode)
            {
                KategoriDto = JsonConvert.DeserializeObject <KategoriDto>(await response.Content.ReadAsStringAsync());

                return(KategoriDto);
            }
            else
            {
                //loglama yap
                return(null);
            }
        }
Beispiel #3
0
        public IActionResult Update(KategoriDto kategoridto)
        {
            var kategori = _kategoriservices.Update(_mapper.Map <Kategoriler>(kategoridto));

            return(NoContent());
        }
Beispiel #4
0
        public async Task <IActionResult> Save(KategoriDto kategoridto)
        {
            var kategori = await _kategoriservices.AddAsync(_mapper.Map <Kategoriler>(kategoridto));

            return(Created(string.Empty, _mapper.Map <KategoriDto>(kategoridto)));
        }