internal static CsOrderitem CreateInternal(CsOrderitemDto dtObj, EntitiesModel1 context)
        {
            if (dtObj == null)
            {
                return(null);
            }
            CsOrderitem oaObj = new CsOrderitem();

            oaObj.OrderitemId = dtObj.OrderitemId;
            oaObj.Title       = dtObj.Title;
            oaObj.OrderId     = dtObj.OrderId;
            oaObj.Id          = dtObj.Id;

            context.Add(oaObj);
            return(oaObj);
        }
Exemple #2
0
        internal static CsOrder CreateInternal(CsOrderDto dtObj, EntitiesModel1 context)
        {
            if (dtObj == null)
            {
                return(null);
            }
            CsOrder oaObj = new CsOrder();

            oaObj.OrderId    = dtObj.OrderId;
            oaObj.Amount     = dtObj.Amount;
            oaObj.OrderDate  = dtObj.OrderDate;
            oaObj.CustomerId = dtObj.CustomerId;
            oaObj.Id         = dtObj.Id;

            context.Add(oaObj);
            return(oaObj);
        }
        internal static CsCustomer CreateInternal(CsCustomerDto dtObj, EntitiesModel1 context)
        {
            if (dtObj == null)
            {
                return(null);
            }
            CsCustomer oaObj = new CsCustomer();

            oaObj.CustomerId = dtObj.CustomerId;
            oaObj.Fname      = dtObj.Fname;
            oaObj.Phone      = dtObj.Phone;
            oaObj.Lname      = dtObj.Lname;
            oaObj.Id         = dtObj.Id;

            context.Add(oaObj);
            return(oaObj);
        }
        internal static CsOrderitem UpdateOrCreateInternal(CsOrderitemDto dtObj, EntitiesModel1 context)
        {
            if (dtObj == null)
            {
                return(null);
            }
            CsOrderitem oaObj = (from t in context.GetAll <CsOrderitem>() where
                                 t.OrderitemId == dtObj.OrderitemId
                                 select t).FirstOrDefault();

            if (oaObj == null)
            {
                return(CreateInternal(dtObj, context));
            }
            oaObj.Title   = dtObj.Title;
            oaObj.OrderId = dtObj.OrderId;
            oaObj.Id      = dtObj.Id;
            return(oaObj);
        }
Exemple #5
0
        internal static CsOrder UpdateOrCreateInternal(CsOrderDto dtObj, EntitiesModel1 context)
        {
            if (dtObj == null)
            {
                return(null);
            }
            CsOrder oaObj = (from t in context.GetAll <CsOrder>() where
                             t.OrderId == dtObj.OrderId
                             select t).FirstOrDefault();

            if (oaObj == null)
            {
                return(CreateInternal(dtObj, context));
            }
            oaObj.Amount     = dtObj.Amount;
            oaObj.OrderDate  = dtObj.OrderDate;
            oaObj.CustomerId = dtObj.CustomerId;
            oaObj.Id         = dtObj.Id;
            return(oaObj);
        }