public async Task <IActionResult> Edit(int id, [Bind("TechnicalEquipmentId,Denotation,Appointment,DatePurchase,LifetimeYear,ContractorId")] TechnicalEquipment technicalEquipment)
        {
            if (id != technicalEquipment.TechnicalEquipmentId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(technicalEquipment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TechnicalEquipmentExists(technicalEquipment.TechnicalEquipmentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractorId"] = new SelectList(_context.Contractors, "ContractorId", "NameCompany", technicalEquipment.ContractorId);
            return(View(technicalEquipment));
        }
        public ActionResult DeleteConfirmed(Guid id)
        {
            TechnicalEquipment technicalEquipment = db.TechnicalEquipment.Find(id);

            db.TechnicalEquipment.Remove(technicalEquipment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,NameTech,UseTech,DatePurchase,Exploitation")] TechnicalEquipment technicalEquipment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(technicalEquipment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(technicalEquipment));
 }
        public async Task <IActionResult> Create([Bind("TechnicalEquipmentId,Denotation,Appointment,DatePurchase,LifetimeYear,ContractorId")] TechnicalEquipment technicalEquipment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(technicalEquipment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractorId"] = new SelectList(_context.Contractors, "ContractorId", "NameCompany", technicalEquipment.ContractorId);
            return(View(technicalEquipment));
        }
        public ActionResult Create([Bind(Include = "ID,NameTech,UseTech,DatePurchase,Exploitation")] TechnicalEquipment technicalEquipment)
        {
            if (ModelState.IsValid)
            {
                technicalEquipment.ID = Guid.NewGuid();
                db.TechnicalEquipment.Add(technicalEquipment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(technicalEquipment));
        }
        // GET: TechnicalEquipments/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TechnicalEquipment technicalEquipment = db.TechnicalEquipment.Find(id);

            if (technicalEquipment == null)
            {
                return(HttpNotFound());
            }
            return(View(technicalEquipment));
        }