Exemple #1
0
        public override T Convert <T, U>(U entity)
        {
            List <Relation> relations = entity as List <Relation>;

            if (relations == null)
            {
                return(default(T));
            }

            List <BO.Common.Relation> boRelation = new List <BO.Common.Relation>();

            foreach (var eachRelation in relations)
            {
                BO.Common.Relation boEachRelation = new BO.Common.Relation();

                boEachRelation.ID           = eachRelation.Id;
                boEachRelation.RelationText = eachRelation.RelationText;
                boEachRelation.IsDeleted    = eachRelation.IsDeleted;

                boRelation.Add(boEachRelation);
            }


            return((T)(object)boRelation);
        }
Exemple #2
0
        public override object Get(int id)
        {
            var acc = _context.Relations.Where(p => p.Id == id && (p.IsDeleted.HasValue == false || p.IsDeleted == false)).FirstOrDefault <Relation>();

            if (acc == null)
            {
                return(new BO.ErrorObject {
                    ErrorMessage = "No record found.", errorObject = "", ErrorLevel = ErrorLevel.Error
                });
            }

            BO.Common.Relation acc_ = ObjectConvert <BO.Common.Relation, Relation>(acc);

            return((object)acc_);
        }
Exemple #3
0
        public override T ObjectConvert <T, U>(U entity)
        {
            Relation relation = entity as Relation;

            if (relation == null)
            {
                return(default(T));
            }

            BO.Common.Relation boRelation = new BO.Common.Relation();

            boRelation.ID           = relation.Id;
            boRelation.RelationText = relation.RelationText;
            boRelation.IsDeleted    = relation.IsDeleted;

            return((T)(object)boRelation);
        }