public async Task <JsonResult> Sil([FromBody] SehirDTO sDTO) { Sehir s = new Sehir(); s.SehirAd = sDTO.sehirAd; s.SehirId = sDTO.sehirId; _sehirRep.Delete(s); await _sehirRep.Commit(); return(Json(sDTO)); }
public async Task <JsonResult> Ekle([FromBody] SehirDTO sDTO) { Sehir s = new Sehir(); //s.SehirAd = sDTO.sehirAd; s = _mapper.Map(sDTO, s); s.SehirId = 0; _sehirRep.Add(s); await _sehirRep.Commit(); return(Json(sDTO)); }
public async Task <JsonResult> Guncel([FromBody] SehirDTO sh) { Sehir sehir = new Sehir(); //sehir.SehirId = sh.sehirId; //sehir.SehirAd = sh.sehirAd; sehir = _map.Map(sh, sehir); _repsehir.Save(sehir); await _repsehir.Comit(); return(Json(sh)); }
[HttpPut("UpdateSehir")] //1 public async Task <SehirDTO> UpdateSehir(int id, [FromBody] SehirDTO sehirDTO) { Sehir secSehir = await _repSehir.Find(sehirDTO.id); secSehir = _mapper.Map(sehirDTO, secSehir); //secSehir.Ad = sehirDTO.ad; //secSehir.resim = sehirDTO.resimYol; _repSehir.Update(secSehir); await _repSehir.Commit(); return(sehirDTO); }
public async Task <SehirDTO> EntrySehir([FromBody] SehirDTO sehirDTO) { Sehir yeniSehir = new Sehir(); yeniSehir = _mapper.Map(sehirDTO, yeniSehir); // yeniSehir.ResimYol = sehirDTO.resimYol; // yeniSehir.Id = sehirDTO.id; // yeniSehir.Ad = sehirDTO.ad; _repSehir.Entry(yeniSehir); await _repSehir.Comit(); return(sehirDTO); }
[HttpPost("EntrySehir")] //2 public async Task <SehirDTO> EntrySehir(int id, [FromBody] SehirDTO sehirDTO) { Sehir yeniSehir = new Sehir(); yeniSehir = _mapper.Map(sehirDTO, yeniSehir); // bu dakısa //bunlar uzun yol(1., 2., 3.) //yeniSehir.Ad = sehirDTO.ad; 1. //yeniSehir.ResimYol = sehirDTO.resimyol; 2. //yeniSehir.Id = sehirDTO.id; 3. _repSehir.Entry(yeniSehir); await _repSehir.Commit(); return(sehirDTO); }