예제 #1
0
 public void Update(RepairType repairType)
 {
     using (repairContext = new RepairContext())
     {
         var item = repairContext.RepairTypes.Find(repairType.Id);
         repairContext.Entry(item).CurrentValues.SetValues(repairType);
         repairContext.SaveChanges();
     }
 }
예제 #2
0
 public void Update(Car Car)
 {
     using (repairContext = new RepairContext())
     {
         var item = repairContext.Cars.Find(Car.Id);
         repairContext.Entry(item).CurrentValues.SetValues(Car);
         repairContext.SaveChanges();
     }
 }
예제 #3
0
 public ActionResult Edit([Bind(Include = "ID,employeeid,fname,lname,password,tell,permiss")] employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employee));
 }
예제 #4
0
 public ActionResult Edit([Bind(Include = "ID,studentid,password,fname,lname,faculty,branch,year,roomno,tell,permiss")] student student)
 {
     if (ModelState.IsValid)
     {
         db.Entry(student).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(student));
 }
 public ActionResult Edit([Bind(Include = "ID,jobname,descript,datetime,status,studentid,roomno,choich")] repair repair)
 {
     if (ModelState.IsValid)
     {
         db.Entry(repair).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(repair));
 }
예제 #6
0
 public ActionResult Edit([Bind(Include = "Id,Name")] RepairType repairType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(repairType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(repairType));
 }
예제 #7
0
 public ActionResult Edit([Bind(Include = "Id,VinNumber,RegistrationNumber,ManufacturedYear")] Car car)
 {
     if (ModelState.IsValid)
     {
         db.Entry(car).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(car));
 }
예제 #8
0
        public async Task <IActionResult> PutRepair(long id, Repair repair)
        {
            if (id != repair.Id)
            {
                return(BadRequest());
            }

            _context.Entry(repair).State = EntityState.Modified;

            await _context.SaveChangesAsync();

            return(NoContent());
        }
예제 #9
0
        private void buttonPartEditDb_Click(object sender, EventArgs e)
        {
            int partid = Convert.ToInt32(labelId.Text);
            var part   = db.Parts.Find(partid);

            part.PartName        = textBoxPartName.Text;
            part.PartUnit        = textBoxPartUnit.Text;
            db.Entry(part).State = EntityState.Modified;
            db.SaveChanges();
            this.Close();
            MainForm form = new MainForm();

            form.MainForm_Load(sender, e);
        }
예제 #10
0
        private void buttonArrivalDocEditDb_Click(object sender, EventArgs e)
        {
            int ardid = Convert.ToInt32(labelId.Text);
            var ard   = db.ArrivalDocs.Find(ardid);

            ard.ArrivalDocName     = textBoxArrivalDocName.Text;
            ard.ArrivalDocProvider = textBoxArrivalDocProvider.Text;
            ard.ArrivalDocDate     = dateTimePickerArrivalDocDate.Value;
            db.Entry(ard).State    = EntityState.Modified;
            db.SaveChanges();
            this.Close();
            MainForm form = new MainForm();

            form.MainForm_Load(sender, e);
        }
예제 #11
0
        private void buttonDepartureDocEditDb_Click(object sender, EventArgs e)
        {
            int ddid = Convert.ToInt32(labelId.Text);
            var dd   = db.DepartureDocs.Find(ddid);

            dd.DepartureDocName      = textBoxDepartureDocNameDb.Text;
            dd.DepartureDocSender    = textBoxDepartureDocSenderDb.Text;
            dd.DepartureDocRecipient = textBoxDepartureDocRecipentDb.Text;
            dd.DepartureDocDate      = dateTimePickerDepartureDocDb.Value;
            db.Entry(dd).State       = EntityState.Modified;
            db.SaveChanges();
            this.Close();
            MainForm form = new MainForm();

            form.MainForm_Load(sender, e);
        }
예제 #12
0
 private void buttonDepartureEdit_Click(object sender, EventArgs e)
 {
     try
     {
         int did = Convert.ToInt32(labelId.Text);
         var d   = db.Departures.Find(did);
         d.DepartureDocId    = Convert.ToInt32(comboBoxDepartureDocDb.SelectedValue);
         d.PartId            = Convert.ToInt32(comboBoxDeparturePartDb.SelectedValue);
         d.DepartureQuantity = Convert.ToInt32(textBoxDeparureQuantityDb.Text);
         db.Entry(d).State   = EntityState.Modified;
         db.SaveChanges();
         this.Close();
         MainForm form = new MainForm();
         form.MainForm_Load(sender, e);
     }
     catch (Exception gg)
     {
         MessageBox.Show(gg.Message);
     }
 }
예제 #13
0
 private void buttonArrivalEditDb_Click(object sender, EventArgs e)
 {
     try
     {
         int arid = Convert.ToInt32(labelId.Text);
         var ar   = db.Arrivals.Find(arid);
         ar.ArrivalDocId    = Convert.ToInt32(comboBoxArrivalDocDb.SelectedValue);
         ar.PartId          = Convert.ToInt32(comboBoxArrivalPartDb.SelectedValue);
         ar.ArrivalCost     = Convert.ToDecimal(textBoxArrivalCost.Text);
         ar.ArrivalQuantity = Convert.ToInt32(textBoxArrivalQuantity.Text);
         ar.ArrivalSum      = ar.ArrivalCost * ar.ArrivalQuantity;
         db.Entry(ar).State = EntityState.Modified;
         db.SaveChanges();
         this.Close();
         MainForm form = new MainForm();
         form.MainForm_Load(sender, e);
     }
     catch (Exception gg)
     {
         MessageBox.Show(gg.Message);
     }
 }