Beispiel #1
0
        public bool Create(PhieuPhatHanh entity)
        {
            var phieuThu = db.PhieuPhatHanh.Add(entity);

            db.SaveChanges();
            return(phieuThu != null);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            PhieuPhatHanh phieuPhatHanh = db.PhieuPhatHanhs.Find(id);

            db.PhieuPhatHanhs.Remove(phieuPhatHanh);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "PhieuPhatHanhId,DaiLyId,LoaiVeSoId,NgayPhat,SLPhat,SLBanDuoc")] PhieuPhatHanh phieuPhatHanh)
 {
     if (ModelState.IsValid)
     {
         db.Entry(phieuPhatHanh).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DaiLyId    = new SelectList(db.DaiLies, "DaiLyId", "TenDaiLy", phieuPhatHanh.DaiLyId);
     ViewBag.LoaiVeSoId = new SelectList(db.LoaiVeSoes, "LoaiVeSoId", "TenTinh", phieuPhatHanh.LoaiVeSoId);
     return(View(phieuPhatHanh));
 }
        public ActionResult Create([Bind(Include = "DaiLyId,LoaiVeSoId,NgayPhat,SLPhat,SLBanDuoc")] PhieuPhatHanh phieuPhatHanh)
        {
            if (ModelState.IsValid)
            {
                db.PhieuPhatHanhs.Add(phieuPhatHanh);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.DaiLyId    = new SelectList(db.DaiLies, "DaiLyId", "TenDaiLy", phieuPhatHanh.DaiLyId);
            ViewBag.LoaiVeSoId = new SelectList(db.LoaiVeSoes, "LoaiVeSoId", "TenTinh", phieuPhatHanh.LoaiVeSoId);
            return(View(phieuPhatHanh));
        }
Beispiel #5
0
        public bool Create(PhieuPhatHanh entity)
        {
            try{
                db.PhieuPhatHanh.Add(entity);
                db.SaveChanges();
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
        // GET: Admin/PhieuPhatHanhs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PhieuPhatHanh phieuPhatHanh = db.PhieuPhatHanhs.Find(id);

            if (phieuPhatHanh == null)
            {
                return(HttpNotFound());
            }
            return(View(phieuPhatHanh));
        }
Beispiel #7
0
 public ActionResult Edit(PhieuPhatHanh entity)
 {
     if (ModelState.IsValid)
     {
         if (PhieuPhatHanhDao.Instance.Update(entity))
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật phiếu phát hành không thành công");
         }
     }
     return(View(entity));
 }
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PhieuPhatHanh phieuPhatHanh = db.PhieuPhatHanhs.Find(id);

            if (phieuPhatHanh == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DaiLyId    = new SelectList(db.DaiLies, "DaiLyId", "TenDaiLy", phieuPhatHanh.DaiLyId);
            ViewBag.LoaiVeSoId = new SelectList(db.LoaiVeSoes, "LoaiVeSoId", "TenTinh", phieuPhatHanh.LoaiVeSoId);
            return(View(phieuPhatHanh));
        }
Beispiel #9
0
        public bool Update(PhieuPhatHanh entity)
        {
            try
            {
                var model = GetSingle(entity.MaPhieuPhatHanh);
                model.MaDaiLy         = entity.MaDaiLy;
                model.NgayPhatHanh    = entity.NgayPhatHanh;
                model.TongSoLuongPhat = entity.TongSoLuongPhat;
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                return(false);
            }

            return(true);
        }
        public ActionResult Create(DotPhatHanh dotPhatHanh, System.DateTime ngayPhat, int loaiVeSoId)
        {
            if (ModelState.IsValid)
            {
                foreach (var item in dotPhatHanh.ListPhieuPhatHanh)
                {
                    PhieuPhatHanh phieuPhatHanh = new PhieuPhatHanh();
                    phieuPhatHanh.LoaiVeSoId = loaiVeSoId;
                    phieuPhatHanh.NgayPhat   = ngayPhat;
                    phieuPhatHanh.DaiLyId    = db.DaiLies.Where(m => m.TenDaiLy == item.TenDaiLy).Select(m => m.DaiLyId).FirstOrDefault();
                    phieuPhatHanh.SLPhat     = item.SLPhat;
                    db.PhieuPhatHanhs.Add(phieuPhatHanh);
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dotPhatHanh));
        }
        public ActionResult Create(DotPhatHanh dotPhatHanh)
        {
            if (ModelState.IsValid)
            {
                foreach (var item in dotPhatHanh.PhieuPhatHanhs)
                {
                    PhieuPhatHanh phieuPhatHanh = new PhieuPhatHanh();
                    phieuPhatHanh.LoaiVeSoId = dotPhatHanh.LoaiVeSoId;
                    phieuPhatHanh.NgayPhat   = dotPhatHanh.NgayPhat;
                    phieuPhatHanh.DaiLyId    = item.DaiLyId;
                    phieuPhatHanh.SLPhat     = item.SLPhat;
                    db.PhieuPhatHanhs.Add(phieuPhatHanh);
                }

                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(dotPhatHanh));
        }