public async Task <IActionResult> Update(Modeller confessed) { Confess confess = confessed.Confess; try { if (string.IsNullOrWhiteSpace(confess.Title) || string.IsNullOrWhiteSpace(confess.Body) || string.IsNullOrWhiteSpace(confess.Category)) { return(RedirectToActionPermanent($"Edit/{confess.Guid}", "Home")); } Confess fetch = await Store.ConfessClass.FetchOneConfessByGuid(confess.Guid, GetToken(GetKey())); fetch.Title = confess.Title; fetch.Body = confess.Body; fetch.Category = confess.Category; //Save await Store.ConfessClass.UpdateConfess(fetch, GetToken(GetKey())); return(RedirectToActionPermanent($"Edit/{confess.Guid}", "Home")); } catch (Exception) { return(RedirectToActionPermanent($"Edit/{confess.Guid}", "Home")); } }
public async Task <IActionResult> Detail() { string id = Request.Path.Value.Split('/').LastOrDefault(); SetCurrent(id); try { //Confess confess = await Store.ConfessClass.FetchOneConfessByGuid(id, GetToken(GetKey())); ConfessLoader loader = await Store.ConfessClass.FetchOneConfessLoaderByGuid(id, GetToken(GetKey()), GetKey()); List <CommentLoader> loaders = await Store.CommentClass.FetchComment(loader.Guid, GetToken(GetKey()), GetKey()); loaders.Reverse(); ViewBag.key = GetKey(); Modeller modeller = new Modeller() { ConfessLoader = loader, Loaders = loaders }; return(View(modeller)); // return RedirectToAction("Detail", "Home", modeller); } catch (Exception) { return(RedirectToActionPermanent("Index", "Home")); } }
public string modelKaydet(string modelAdi, int urunid, int markaid) { try { if (!string.IsNullOrWhiteSpace(modelAdi)) { Modeller ekle = new Modeller(); ekle.ModelAdi = modelAdi; ekle.UrunID = urunid; ekle.MarkaID = markaid; db.Modeller.Add(ekle); int sonuc = db.SaveChanges(); if (sonuc > 0) { return("Model eklendi."); } } return("Güncelleme Başarısız"); } catch (Exception) { return("Hata Oluştu"); } }
private void cbModeller_SelectedIndexChanged(object sender, EventArgs e) { txtModel.Text = cbModeller.SelectedItem.ToString(); Modeller m = new Modeller(); txtModelID.Text = m.ModelIDGetir(txtModel.Text).ToString(); }
public PartialViewResult Menu() { Modeller modeller = new Modeller { Categories = Logic.Categories.ToList(), ListItems = Logic.GetCategoriesLists() }; return(PartialView(modeller)); }
public bool ModelSil(Model model) { foreach (Model mModel in Modeller) { if (model.ID == mModel.ID) { Modeller.Remove(model); return(true); } } return(false); }
private void cbMarkalar_SelectedIndexChanged(object sender, EventArgs e) { txtMarkaAd.Text = cbMarkalar.SelectedItem.ToString(); Marka m = new Marka(); txtMarkaID.Text = m.MarkaIDGetir(txtMarkaAd.Text).ToString(); txtModelID.Clear(); txtModel.Clear(); cbModeller.Items.Clear(); Modeller mr = new Modeller(); mr.ModelleriGetir(cbModeller, Convert.ToInt32(txtMarkaID.Text)); }
private void AracModel_Load(object sender, EventArgs e) { this.Top = 0; this.Left = 0; Sinif s = new Sinif(); s.SiniflariGetir(cbSiniflar); Modeller md = new Modeller(); md.ModelleriGetir(lvModeller); txtModel.Focus(); }
public async Task <IActionResult> Index() { string id = Request.Path.Value.Split('/').LastOrDefault(); //get the key string key = GetKey(); string token = GetToken(key); //ActionResult<List<ConfessLoader>> okResult = confessController.FetchAll(GetKey()); //List<ConfessLoader> results = (List<ConfessLoader>)((OkObjectResult)okResult.Result).Value; List <ConfessLoader> results = new List <ConfessLoader>(); if (string.IsNullOrEmpty(id)) { results = await Store.ConfessClass.FetchAllConfess(token, key); } else { if (id == "mine") { results = await Store.ConfessClass.FetchMyConfessions(token, key); } else { if (Logic.Categories.Contains(id)) { results = await Store.ConfessClass.FetchConfessByCategory(id, token, key); } else { results = await Store.ConfessClass.FetchAllConfess(token, key); } } } results.Reverse(); Modeller modeller = new Modeller { ConfessLoaders = results, Categories = Logic.Categories.ToList(), ListItems = Logic.GetCategoriesLists() }; //var list = //Log user visit return(View(modeller)); }
public async Task <IActionResult> Detail(Modeller confessed) { Comment newComment = confessed.Comment; newComment.Owner_Guid = GetKey(); newComment.Confess_Guid = GetCurrent(); if (!string.IsNullOrWhiteSpace(newComment.Body)) { await Store.CommentClass.CreateComment(newComment, newComment.Confess_Guid, GetToken(GetKey()), GetKey()); } return(RedirectToActionPermanent($"Detail/{newComment.Confess_Guid}", "Home")); //return View("Detail"); // return View(); }
private void btnSil_Click(object sender, EventArgs e) { if (MessageBox.Show("Silmek istediğinizden emin misiniz?", "UYARI", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Modeller m = new Modeller(); if (m.ModelSil(Convert.ToInt32(txtModelID.Text))) { MessageBox.Show("Model Silindi."); m.ModelleriGetir(lvModeller); Temizle(); btnSil.Enabled = false; btnDegistir.Enabled = false; } } }
public bool ModelEkle(Model model) { foreach (Model mModel in Modeller) { if (model.ID == mModel.ID) { return(false); } } // Her yeni eklenen model için Otomatik olarak ModelKod üretiliyor... model.ModelKod = (Adi[0] + Adi[1]).ToString() + 100 + Modeller.Count + 1; Modeller.Add(model); return(true); }
//public IActionResult Edit() //{ // ViewData["Message"] = "Your contact page."; // return View(); //} public async Task <IActionResult> Edit() { string guid = Request.Path.Value.Split('/').LastOrDefault(); if (!string.IsNullOrEmpty(guid)) { Confess confess = await Store.ConfessClass.FetchOneConfessByGuid(guid, GetToken(GetKey())); Modeller modeller = new Modeller() { Confess = confess, ListItems = Logic.GetCategoriesLists(confess.Category) }; return(View(modeller)); } return(View()); }
public async Task <IActionResult> Delete(Modeller confessed) { string id = string.Empty; if (confessed.ConfessLoader != null) { id = confessed.ConfessLoader.Guid; } else if (confessed.Confess != null) { id = confessed.Confess.Guid; } if (!string.IsNullOrEmpty(id)) { await Store.ConfessClass.DeleteConfess(id, GetToken(GetKey())); } return(RedirectToActionPermanent("Index", "Home")); }
private void btnKaydet_Click(object sender, EventArgs e) { if (txtSinifAdi.Text.Trim() != "" && txtMarkaAd.Text.Trim() != "" && txtModel.Text.Trim() != "") { Modeller m = new Modeller(); txtResimID.Text = m.ResimIDGetir(txtModel.Text).ToString(); if (m.ModelVarmi(Convert.ToInt32(txtMarkaID.Text), txtModel.Text)) { MessageBox.Show("Model zaten kayıtlı!"); } else { m.SinifID = Convert.ToInt32(txtSinifID.Text); m.MarkaID = Convert.ToInt32(txtMarkaID.Text); m.ModelAd = txtModel.Text.ToUpper(); m.Klima = cbKlima.SelectedItem.ToString(); m.YakitTipi = cbYakitTipi.SelectedItem.ToString(); m.VitesTipi = cbVites.SelectedItem.ToString(); m.Aciklama = txtAciklama.Text.ToUpper(); m.ModelResmi = Convert.ToInt32(txtResimID.Text); if (m.ModelEkle(m)) { MessageBox.Show("Model başarı ile eklendi."); m.ModelleriGetir(lvModeller); Temizle(); btnKaydet.Enabled = false; btnDegistir.Enabled = true; btnSil.Enabled = true; } else { MessageBox.Show("Model eklenemedi."); } } } else { MessageBox.Show("Sınıf Adı,Model ve Marka Adı boş bırakılamaz."); } }
public async Task <IActionResult> Add(Modeller confessed) { try { Confess confess = confessed.Confess;// new Confess();// (Confess)confessed; if (string.IsNullOrWhiteSpace(confess.Title) || string.IsNullOrWhiteSpace(confess.Body) || string.IsNullOrWhiteSpace(confess.Category)) { return(RedirectToActionPermanent("Index", "Home")); } confess.Owner_Guid = GetKey(); //Save await Store.ConfessClass.CreateConfess(confess, GetToken(GetKey())); return(RedirectToActionPermanent("Index", "Home")); } catch (Exception) { return(RedirectToActionPermanent("Index", "Home")); } }
private void txtModeleGoreArama_TextChanged(object sender, EventArgs e) { Modeller m = new Modeller(); m.ModelleriGetirByAdaGore(txtModeleGoreArama.Text, lvModeller); }