Beispiel #1
0
        public void UpdateCutFinish(Cut cut)
        {
            IEnumerable<Cut> cutD = from c in context.Cut
                                    where c.Id == cut.Id
                                    select c;
            Cut cp = cutD.FirstOrDefault();
            cp.Id = cut.Id;
            cp.Image = cut.Name;
            cp.Lot = cut.Lot;
            cp.EstatusCut = cut.EstatusCut;
            cp.DateStart = cut.DateStart;
            cp.DateFinish = cut.DateFinish;
            cp.CodeCut = cut.CodeCut;

            //     Student student = db.Students.Find(s => s.StudentID == ViewModel.StudentID);
            
            context.Entry(cp).State = EntityState.Modified;
            // context.Cut.Attach(cut);
            context.SaveChanges();
        }
 private void SaveCutButton_Click(object sender, RoutedEventArgs e)
 {
     if(ControlValidation.IsEmpty(new TextBox[] {CodeCut,LotCut,DateStartCut,DateFinishCut}))
     {
         Cut cut = new Cut();
         cut.Name = NameCut.Text.ToString();
         cut.CodeCut = int.Parse(CodeCut.Text.ToString());
         cut.Lot = int.Parse(LotCut.Text.ToString());
         cut.DateStart = DateTime.Parse(DateStartCut.Text.ToString());
         cut.DateFinish = DateTime.Parse(DateFinishCut.Text.ToString());
         cut.EstatusCut = (Estatus)EstatusComboBox.SelectedItem;
         cut.Image = pathImage;
         dataSource.AddNewCut(cut);
         listViewCuts.ItemsSource = dataSource.GetCuts();
     }
     else
     {
         MessageBox.Show("Please some files are empty");
     }
 }
Beispiel #3
0
 public void AddNewCut(Cut cut)
 {
     context.Cut.Add(cut);
     context.SaveChanges();
 }