private void OnAddNewCost(object sender, RoutedEventArgs e) { String costDetail = txtCostDetail.Text; String cost = txtCost.Text; if (cost == "") { MessageBox.Show("Bạn chưa nhập giá"); return; } if (costDetail == "") { MessageBox.Show("Bạn chưa nhập nội dung chi tiêu"); return; } MucChi mucChi = new MucChi(); mucChi.STT = mucChiDAOlmpl.GetAllMucChi().Count() + extraExpense.Count() + 1; mucChi.SoTien = Int32.Parse(cost); mucChi.NDChi = costDetail; mucChi.MaChuyenDi = maChuyenDi; extraExpense.Add(mucChi); txtCostDetail.Text = ""; txtCost.Text = ""; }
// GET: ChiTheoMuc public ActionResult Index(MucChi mucchi) { if (Session["TaiKhoan"] == null || Session["TaiKhoan"].ToString() == "") { return(RedirectToAction("DangNhap", "DangKyDangNhap")); } return(View(db.MucChis.ToList())); }
public ActionResult ChinhSua(MucChi mucchi, FormCollection f) { if (ModelState.IsValid) { db.Entry(mucchi).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewBag.ThongBao = "Lưu lại thành công"; } return(View(mucchi)); }
public ActionResult XoaMuc(int MaMuc) { MucChi mucchitieu = db.MucChis.SingleOrDefault(n => n.MaMuc == MaMuc); if (mucchitieu == null) { Response.StatusCode = 404; return(null); } return(View(mucchitieu)); }
public ActionResult ThemMuc(MucChi mucchi) { if (ModelState.IsValid) { db.MucChis.Add(mucchi); db.SaveChanges(); ViewBag.ThongBao = "Đã thêm mục thành công"; return(RedirectToAction("ThemMuc", "DropDown")); } return(View()); }
public ActionResult XoaMucChi(int MaMuc) { MucChi mucchitieu = db.MucChis.SingleOrDefault(n => n.MaMuc == MaMuc); if (mucchitieu == null) { Response.StatusCode = 404; return(null); } db.MucChis.Remove(mucchitieu); db.SaveChanges(); return(RedirectToAction("ListMuc", "DropDown")); }