Beispiel #1
0
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        Label IdLabel = e.Item.FindControl("IdLabel") as Label;
        int   id      = Convert.ToInt32(IdLabel.Text);

        if (e.CommandName == "sil")
        {
            marka ur = marka.Select(id);
            if (ur == null)
            {
                Labelbilgi.Text = "<p class='msg error'><b>KAYIT BULUNAMADI !</b></p>";
                return;
            }


            Result <int> sonuc = ur.Delete();

            if (sonuc.HasError)
            {
                Labelbilgi.Text = "<p class='msg error'><b>Hata :" + sonuc.CustomErrorMessage + "</b></p>";
                return;
            }
            else
            {
                Labelbilgi.Text = "<p class='msg done'><b>BAŞARIYLA SİLİNDİ...</b></p>";
                AccessDataSource1.Select(DataSourceSelectArguments.Empty);
                ListView1.DataBind();
            }
        }
        else if (e.CommandName == "duzenle")
        {
            Response.Redirect("markas-duzenle.aspx?Id=" + id.ToString());
        }
    }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            marka marka = db.marka.Find(id);

            db.marka.Remove(marka);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "id,cat_id,name,marka_id")] marka marka)
 {
     if (ModelState.IsValid)
     {
         db.Entry(marka).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.cat_id   = new SelectList(db.cat, "id", "name", marka.cat_id);
     ViewBag.marka_id = new SelectList(db.marka_norm, "id", "name", marka.marka_id);
     return(View(marka));
 }
Beispiel #4
0
        // GET: Cingo/Markas/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            marka marka = db.marka.Find(id);

            if (marka == null)
            {
                return(HttpNotFound());
            }
            return(View(marka));
        }
Beispiel #5
0
        // GET: Cingo/Markas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            marka marka = db.marka.Find(id);

            if (marka == null)
            {
                return(HttpNotFound());
            }
            ViewBag.cat_id   = new SelectList(db.cat, "id", "name", marka.cat_id);
            ViewBag.marka_id = new SelectList(db.marka_norm, "id", "name", marka.marka_id);
            return(View(marka));
        }
Beispiel #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request["Id"].ToString()))
            {
                int id = Convert.ToInt32(Request["Id"].ToString());

                marka duzenle = marka.Select(id);

                adiTextBox.Text = duzenle.Adi;

                Image1.ImageUrl = duzenle.Resim;
            }
        }
    }
Beispiel #7
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int id = Convert.ToInt32(Request["Id"].ToString());

        marka duzenle = marka.Select(id);


        string resim = "", mesaj = "";

        if (FileUpload1.HasFile)
        {
            if (ClassBLL.resimKaydet2(FileUpload1, "~/panel/imgUrun", out resim, out mesaj))
            {
                Image1.ImageUrl = resim;
            }
            if (FileUpload1.HasFile && mesaj != "")
            {
                Labelbilgi.Text = mesaj;
                return;
            }
            resim = Image1.ImageUrl;
        }


        duzenle.Adi   = adiTextBox.Text;
        duzenle.Resim = Image1.ImageUrl;



        Result <int> sonuc = duzenle.Update();

        if (sonuc.HasError)
        {
            Labelbilgi.Text = "<p class='msg error'><b>Hata :" + sonuc.CustomErrorMessage + "</b></p>";
            return;
        }
        else
        {
            Labelbilgi.Text = "<p class='msg done'><b>Kayıt Başarılı...</b></p>";
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string resim = "", mesaj = "";

        if (!FileUpload1.HasFile)
        {
            Labelbilgi.Text = "<p class='msg warning'><b>Resim Seçmelisiniz</b></p>";
            return;
        }

        if (ClassBLL.resimKaydet2(FileUpload1, "~/panel/imgUrun", out resim, out mesaj))
        {
            Image1.ImageUrl = resim;
        }
        if (FileUpload1.HasFile && mesaj != "")
        {
            Labelbilgi.Text = mesaj;
            return;
        }
        marka yeni = new marka();

        yeni.Adi = adiTextBox.Text;

        yeni.Resim = Image1.ImageUrl;


        Result <int> sonuc = yeni.Insert();

        if (sonuc.HasError)
        {
            Labelbilgi.Text = "<p class='msg error'><b>Hata :" + sonuc.CustomErrorMessage + "</b></p>";
            return;
        }
        else
        {
            Response.Redirect("markas.aspx");
        }
    }