public void AddPicture(int maintenanceId, string photoPath)
 {
     var maintenancephoto = new MaintenancePhoto { MaintenanceID = maintenanceId, PhotoPath = photoPath };
     if (!ModelState.IsValid) return;
     _db.MaintenancePhotoes.Add(maintenancephoto);
     _db.SaveChanges();
 }
 public ActionResult Edit(MaintenancePhoto maintenancephoto)
 {
     if (ModelState.IsValid)
     {
         db.Entry(maintenancephoto).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.MaintenanceID = new SelectList(db.MaintenanceOrders, "MaintenanceID", "Description",
                                            maintenancephoto.MaintenanceID);
     return View(maintenancephoto);
 }
        public ActionResult Create(MaintenancePhoto maintenancephoto)
        {
            if (ModelState.IsValid)
            {
                db.MaintenancePhotoes.Add(maintenancephoto);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.MaintenanceID = new SelectList(db.MaintenanceOrders, "MaintenanceID", "Description",
                                                   maintenancephoto.MaintenanceID);
            return View(maintenancephoto);
        }