コード例 #1
0
ファイル: CurveRepository.cs プロジェクト: Juliusz/Test
        public CurveDetail Add(CurveDetail parent)
        {
            // there is no hierarchy so parent can be safely ignored
            CurveDetail detail = new CurveDetail();
            detail.Default(Context.UserName);

            Curve curve = new Curve();
            curve.Default(Context.UserName);

            if (Context.Curves.Local.Count() > 0)
            {
                curve.CurveID = Context.Curves.Local.Max(x => x.CurveID) + 1;
            }
            else
            {
                curve.CurveID = 1;
            }

            detail.Curve = curve;
            detail.CurveID = curve.CurveID;
            detail.Name = "Curve Name";
            Context.Curves.Add(curve);
            Context.CurveDetails.Add(detail);

            return detail;
        }