public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Osavotjad osavotjad = await db.Osavotjads.FindAsync(id);

            db.Osavotjads.Remove(osavotjad);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Edit([Bind(Include = "ID,Eesnimi,Perenimi,Isikukood,Makskmisviis,Lisainfo,Yritus_ID")] Osavotjad osavotjad)
        {
            if (ModelState.IsValid)
            {
                db.Entry(osavotjad).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.Yritus_ID = new SelectList(db.Yritus1, "ID", "Ürituse_nimi", osavotjad.Yritus_ID);
            return(View(osavotjad));
        }
        // GET: Osavotjads/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Osavotjad osavotjad = await db.Osavotjads.FindAsync(id);

            if (osavotjad == null)
            {
                return(HttpNotFound());
            }
            return(View(osavotjad));
        }
        // GET: Osavotjads/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Osavotjad osavotjad = await db.Osavotjads.FindAsync(id);

            if (osavotjad == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Yritus_ID = new SelectList(db.Yritus1, "ID", "Ürituse_nimi", osavotjad.Yritus_ID);
            return(View(osavotjad));
        }