public void Create([FromBody] OgrenciRequest ogrenci) { _context.ogrenci.Add(new Ogrenci() { OgrenciId = Guid.NewGuid(), FirstName = ogrenci.FirstName, LastName = ogrenci.LastName, OdevId = ogrenci.OdevId, }); _context.SaveChanges(); }
public async Task ModifiedAsync(OgrenciRequest ogrenciRequest, int ogrenciId) { var ogrenci = await _ogrenciRepository.GetAsync(ogrenciId); ogrenci.Ad = ogrenciRequest.Ad; ogrenci.Soyad = ogrenciRequest.Soyad; ogrenci.No = ogrenciRequest.No; ogrenci.Gsm = ogrenciRequest.Gsm; ogrenci.Eposta = ogrenciRequest.Eposta; ogrenci.Durum = ogrenciRequest.Durum; ogrenci.ModifiedDate = DateTime.Now; await _ogrenciRepository.ModifiedAsync(ogrenci); }
public void Update(OgrenciRequest ogrenci, Guid id) { Ogrenci result; using (var db = _context) { result = db.ogrenci.Where(c => c.OgrenciId == id).FirstOrDefault(); result.FirstName = ogrenci.FirstName; result.LastName = ogrenci.LastName; result.OdevId = ogrenci.OdevId; db.SaveChanges(); } }
public async Task AddAsync(OgrenciRequest ogrenciRequest) { Models.Ogrenci ogrenci = new Models.Ogrenci() { Ad = ogrenciRequest.Ad, No = ogrenciRequest.No, Soyad = ogrenciRequest.Soyad, CreatedDate = DateTime.Now, Gsm = ogrenciRequest.Gsm, Eposta = ogrenciRequest.Eposta, Durum = ogrenciRequest.Durum, ModifiedDate = DateTime.Now }; await _ogrenciRepository.AddAsync(ogrenci); }
public async Task PostModified(int ogrId, [FromBody] OgrenciRequest ogrenciRequest) { await _ogrenciBusiness.ModifiedAsync(ogrenciRequest, ogrId); }
public async Task Post([FromBody] OgrenciRequest ogrenciRequest) { await _ogrenciBusiness.AddAsync(ogrenciRequest); }