public ActionResult Create(FormCollection formcollection)
        {
            var phieuyeucau = new tbl_PhieuYeuCauNhap();
            //var userSession = (UserLogin)Session[Common.CommonConstants.USER_SESSION];
            //var IDNCC = formcollection["hdnNCC"];
            long IDNCC = long.Parse(formcollection["hdnNCC"]);

            phieuyeucau.IDncc = IDNCC;
            try
            {
                var id = new PhieuYeuCauDAO().Insert(phieuyeucau);
                var phieuyeucaulist = (List <PhieuYeuCauViewModel>)Session[SESSION_PRODUCT_YC];
                var detailDao       = new Model.DAO.ChiTietPhieuYCDAO();
                var addquantity     = new SanPhamDAO();
                foreach (var item in phieuyeucaulist)
                {
                    var phieuyeucaudetail = new tbl_ChiTietPhieuYC();
                    phieuyeucaudetail.IDSanPham     = item.sanPham.ID;
                    phieuyeucaudetail.IDPhieuYeuCau = id;
                    phieuyeucaudetail.iSoLuongYC    = item.iSoLuongYC;
                    detailDao.Insert(phieuyeucaudetail);
                    addquantity.addquantitySanPham(item.sanPham.ID, item.iSoLuongYC);
                }
            }
            catch (Exception ex)
            {
                return(Redirect("/Admin/PhieuYeuCauNhap/Create"));
            }
            Session[SESSION_PRODUCT_YC] = null;
            return(Redirect("/Admin/PhieuYeuCauNhap/Index"));
        }
 public bool Insert(tbl_ChiTietPhieuYC detail)
 {
     try
     {
         db.tbl_ChiTietPhieuYC.Add(detail);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }