public ActionResult Edit([Bind(Include = "Id,MaNV,MaDA,SoGio")] THAMGIA tHAMGIA)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tHAMGIA).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.MaDA = new SelectList(db.DUANs, "MaDA", "TenDA", tHAMGIA.MaDA);
     ViewBag.MaNV = new SelectList(db.NHANVIENs, "MaNV", "TenNV", tHAMGIA.MaNV);
     return(View(tHAMGIA));
 }
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            THAMGIA tHAMGIA = db.THAMGIAs.Find(id);

            if (tHAMGIA == null)
            {
                return(HttpNotFound());
            }
            return(View(tHAMGIA));
        }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            THAMGIA tHAMGIA = db.THAMGIAs.Find(id);

            if (tHAMGIA == null)
            {
                return(HttpNotFound());
            }
            ViewBag.MaDA = new SelectList(db.DUANs, "MaDA", "TenDA", tHAMGIA.MaDA);
            ViewBag.MaNV = new SelectList(db.NHANVIENs, "MaNV", "TenNV", tHAMGIA.MaNV);
            return(View(tHAMGIA));
        }
Exemplo n.º 4
0
        private void addMemberToTrip_Click(object sender, RoutedEventArgs e)
        {
            if (trip.SelectedItem == null)
            {
                MessageBox.Show("Chưa chọn chuyến đi", "Cảnh báo", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (member.SelectedItem == null)
            {
                MessageBox.Show("Chưa chọn thành viên", "Cảnh báo", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else if (money.Text.Trim() == "")
            {
                MessageBox.Show("Chưa nhập tiền thu", "Cảnh báo", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                var      item_CD = trip.SelectedItem as CHUYENDI;
                var      CD      = item_CD.MA_CHUYENDI;
                var      item_TV = member.SelectedItem.ToString();
                string[] arr     = item_TV.Split(',');
                var      TV      = arr[0].Substring(9);

                var tg = new THAMGIA()
                {
                    MACD      = CD,
                    MATV      = TV,
                    TIENTHU   = Convert.ToDouble(money.Text.Trim()),
                    THANHVIEN = (from tv in DataProvider.Ins.DB.THANHVIEN
                                 where tv.MATV == TV
                                 select tv).ToList()[0],
                };
                DataProvider.Ins.DB.THAMGIA.Add(tg);
                DataProvider.Ins.DB.SaveChanges();
                money.Text = default;
                reload();
            }
        }