Exemplo n.º 1
0
        public static tblListHandoverReply InsertListHandoverReply(tblListHandoverReply handoverReply, List <tblHandover> listHandover, tblNumberGenerate numberGenerate)
        {
            var db = new dbTrainEntities(ConnectionController.GetConnection());

            db.AddTotblNumberGenerates(numberGenerate);
            db.AddTotblListHandoverReplies(handoverReply);

            foreach (tblHandover handover in listHandover)
            {
                tblHandover obj = db.tblHandovers.Where(g => g.ID == handover.ID).FirstOrDefault();
                if (obj != null)
                {
                    obj.tblListHandoverReply = handoverReply;
                }
            }
            int result = db.SaveChanges();

            if (result > 0)
            {
                return(handoverReply);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        public static int AddNew(tblNumberGenerate number)
        {
            var db = new dbTrainEntities(ConnectionController.GetConnection());

            db.AddTotblNumberGenerates(number);

            return(db.SaveChanges());
        }