public IHttpActionResult PutOyuncular(int id, Oyuncular oyuncular) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != oyuncular.oyuncuid) { return(BadRequest()); } db.Entry(oyuncular).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!OyuncularExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult YeniOyuncuEkle(Oyuncular oyuncu, HttpPostedFileBase file) { DatabaseContext db = new DatabaseContext(); if (oyuncu != null) { string ImageName = System.IO.Path.GetFileName(file.FileName); string physicalPath = Server.MapPath("~/images/" + ImageName); // save image in folder file.SaveAs(physicalPath); Oyuncular yeni = new Oyuncular() { Adi = oyuncu.Adi, Soyadi = oyuncu.Soyadi, Dogum_Tarihi = Convert.ToDateTime(oyuncu.Dogum_Tarihi), Resim = ImageName }; db.Oyuncular.Add(yeni); db.SaveChanges(); return(RedirectToAction("OyuncularListesi")); } else { return(RedirectToAction("YeniOyuncuEkle")); } }
public IHttpActionResult GetOyuncular(int id) { Oyuncular oyuncular = db.Oyuncular.Find(id); if (oyuncular == null) { return(NotFound()); } return(Ok(oyuncular)); }
public IHttpActionResult PostOyuncular(Oyuncular oyuncular) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Oyuncular.Add(oyuncular); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = oyuncular.oyuncuid }, oyuncular)); }
public IHttpActionResult DeleteOyuncular(int id) { Oyuncular oyuncular = db.Oyuncular.Find(id); if (oyuncular == null) { return(NotFound()); } db.Oyuncular.Remove(oyuncular); db.SaveChanges(); return(Ok(oyuncular)); }
internal bool OyuncuSil(Oyuncular model) { try { var sil = _db.Oyuncular.Single(x => x.ID == model.ID); _db.Oyuncular.Remove(sil); _db.SaveChanges(); return(true); } catch { return(false); } }
public ActionResult OyuncuEkle(Oyuncular oyuncu) { try { obj.Takims = ent.Takimlar.ToList(); obj.Oyunculars = ent.Oyuncular.ToList(); ent.Oyuncular.Add(oyuncu); ent.SaveChanges(); return(View(obj)); } catch (Exception) { return(HttpNotFound()); } }
public ActionResult GolKralligi(Oyuncular oyuncu) { try { var _oyuncu = ent.Oyuncular.Find(oyuncu.oyuncuID); _oyuncu.golSayisi = oyuncu.golSayisi; ent.SaveChanges(); obj.Oyunculars = ent.Oyuncular.OrderByDescending(m => m.golSayisi).ToList(); return(View(obj)); } catch (Exception) { return(HttpNotFound()); } }
public ActionResult Oyuncu_Duzenle(int?id, string resim) { DatabaseContext db = new DatabaseContext(); Oyuncular kayit = db.Oyuncular.Where(k => k.Oyuncular_ID == id).SingleOrDefault(); Oyuncular yeni = new Oyuncular() { Oyuncular_ID = kayit.Oyuncular_ID, Adi = kayit.Adi, Soyadi = kayit.Soyadi, Dogum_Tarihi = kayit.Dogum_Tarihi, Resim = kayit.Resim }; return(View(yeni)); }
internal bool OyuncuDuzenle(Oyuncular model) { try { var duzen = _db.Oyuncular.First(x => x.ID == model.ID); duzen.Adi = model.Adi.Trim(); duzen.Soyadi = model.Soyadi.Trim(); _db.SaveChanges(); return(true); } catch { return(false); } }
public ActionResult OyuncuSil(Oyuncular model) { if (ModelState.IsValid) { bool kontrol = _film.OyuncuSil(model); if (kontrol) { return(RedirectToAction("OyuncuListesi")); } else { return(RedirectToAction("HataBildirimi", new { Bilgi = "Oyuncu Silinirken Hata Oluştu" })); } } return(View(model)); }
public ActionResult Oyuncu_Duzenle(Oyuncular veri, HttpPostedFileBase file) { DatabaseContext db = new DatabaseContext(); Oyuncular kayit = db.Oyuncular.Where(k => k.Oyuncular_ID == veri.Oyuncular_ID).SingleOrDefault(); kayit.Adi = veri.Adi; kayit.Soyadi = veri.Soyadi; kayit.Dogum_Tarihi = veri.Dogum_Tarihi; if (file != null) { string ImageName = System.IO.Path.GetFileName(file.FileName); string physicalPath = Server.MapPath("~/images/" + ImageName); // save image in folder file.SaveAs(physicalPath); kayit.Resim = ImageName; } db.SaveChanges(); return(RedirectToAction("OyuncularListesi")); }
internal bool OyuncuEkle(Oyuncular model) { try { model.Adi = model.Adi.Trim(); model.Soyadi = model.Soyadi.Trim(); var o = _db.Oyuncular.SingleOrDefault(x => x.Adi == model.Adi); if (o != null) { return(true); } _db.Oyuncular.Add(model); _db.SaveChanges(); return(true); } catch { return(false); } }
public Oyuncular GetListeliFilmOyuncusu(string oyuncuadi) { Oyuncular oyuncu = db.Oyuncular.FirstOrDefault(x => x.oyuncuadi == oyuncuadi); return(oyuncu); }