Exemplo n.º 1
0
        //public int DeleteGFStrategy(int gstrategy)
        //{
        //    var cont = new SeniorLinqDataContext();
        //    var query = (from strat in cont.GFStrategies where strat.StrategyId == gstrategy select strat).SingleOrDefault();
        //    cont.GFStrategies.DeleteOnSubmit(query);
        //    cont.SubmitChanges();
        //    var q = (from strat in cont.GFStrategies where strat.StrategyId == gstrategy select strat).SingleOrDefault();
        //    if (q == null)
        //        return 1;
        //    else return -1;
        //}
        public GFStrategyModel RetreiveGFStrategy(int gfstrategyid)
        {
            var             cont     = new SeniorLinqDataContext();
            var             query    = (from fgstr in cont.GFStrategies where fgstr.StrategyId == gfstrategyid select fgstr).SingleOrDefault();
            GFStrategyModel gfstratm = new GFStrategyModel();

            gfstratm.StrategyId  = query.StrategyId;
            gfstratm.Title       = query.Title;
            gfstratm.Description = query.Description;
            return(gfstratm);
        }
Exemplo n.º 2
0
        public int AddGFStrategy(GFStrategyModel gfstrategy)
        {
            var        cont = new SeniorLinqDataContext();
            GFStrategy temp = new GFStrategy();

            temp.Title      = gfstrategy.Title;
            temp.StrategyId = gfstrategy.StrategyId;
            cont.GFStrategies.InsertOnSubmit(temp);
            cont.SubmitChanges();
            var query = (from gs in cont.GFStrategies where gs.StrategyId == temp.StrategyId && gs.Title == temp.Title select gs.Title).SingleOrDefault();

            if (query != null)
            {
                return(1);
            }
            return(-1);
        }