Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Voditel voditel = db.Voditels.Find(id);

            db.Voditels.Remove(voditel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 private void button1_Click(object sender, EventArgs e)
 {
     using (Voditel f = new Voditel())
     {
         f.ShowDialog();
         this.OnLoad(e);
     }
 }
Esempio n. 3
0
 public ActionResult Edit([Bind(Include = "Id,Name")] Voditel voditel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(voditel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(voditel));
 }
Esempio n. 4
0
        public ActionResult Create([Bind(Include = "Id,Name")] Voditel voditel)
        {
            if (ModelState.IsValid)
            {
                db.Voditels.Add(voditel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(voditel));
        }
Esempio n. 5
0
        public ActionResult Create([Bind(Include = "Id,fio,license_expire,categories")] Voditel voditel)
        {
            if (ModelState.IsValid)
            {
                db.Voditel.Add(voditel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(voditel));
        }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "Id,fio,license_expire,categories")] Voditel voditel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(voditel).State = EntityState.Modified;
         voditel.fio             = voditel.fio.Trim();
         voditel.categories      = voditel.categories.Trim();
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(voditel));
 }
Esempio n. 7
0
        // GET: Voditels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Voditel voditel = db.Voditels.Find(id);

            if (voditel == null)
            {
                return(HttpNotFound());
            }
            return(View(voditel));
        }
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Items.Dostup = 1;
            Items.listItems.Clear();

            for (int i = 1; i <= dataGridView1.ColumnCount - 1; i++)
            {
                Items.listItems.Add(dataGridView1.Rows[e.RowIndex].Cells[i].Value.ToString());
            }
            using (Voditel f = new Voditel())
            {
                f.ShowDialog();
                this.OnLoad(e);
            }
        }
Esempio n. 9
0
        // GET: Voditels/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Voditel voditel = db.Voditel.Find(id);

            if (voditel == null)
            {
                return(HttpNotFound());
            }
            ViewBag.RaceDate  = "" + voditel.license_expire.Year + "-" + (voditel.license_expire.Month < 10 ? "0" : "") + voditel.license_expire.Month + "-" + (voditel.license_expire.Day < 10 ? "0" : "") + voditel.license_expire.Day;
            ViewBag.RaceDate2 = "" + (voditel.license_expire.Day < 10 ? "0" : "") + voditel.license_expire.Day + "." + (voditel.license_expire.Month < 10 ? "0" : "") + voditel.license_expire.Month + "." + voditel.license_expire.Year;

            return(View(voditel));
        }
Esempio n. 10
0
        // GET: Voditels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Voditel voditel = db.Voditel.Find(id);

            if (voditel == null)
            {
                return(HttpNotFound());
            }

            ViewBag.AllowDelete = 1;
            var ейсыВодителя = db.ейс.Where(x => (x.ВодительID == (int)id));

            if (ейсыВодителя.Count() > 0)
            {
                ViewBag.AllowDelete = 0;
            }

            return(View(voditel));
        }