Ejemplo n.º 1
0
        public static Accessright MapModelToAccessright(AccessrightModel model)
        {
            Accessright accessright = new Accessright()
            {
                ID                = model.Id,
                Description       = model.Description,
                Name              = model.Name,
                Accessright_Right = new List <Accessright_Right>()
            };

            model.Accessright_Rights.ForEach(a => accessright.Accessright_Right.Add(new Accessright_Right()
            {
                Id              = a.Id,
                AccessType      = (int)a.AccessType,
                AccessTypeRight = (int)a.AccessTypeRight,
                AccessrightId   = model.Id
            }));

            return(accessright);
        }
Ejemplo n.º 2
0
        public static AccessrightModel MapAccessright(Accessright accessright, bool deepLoad)
        {
            AccessrightModel model = new AccessrightModel()
            {
                Id          = accessright.ID,
                Description = accessright.Description,
                Name        = accessright.Name
            };

            foreach (var right in accessright.Accessright_Right)
            {
                model.Accessright_Rights.Add(new AccessrightRightModel()
                {
                    AccessType      = (AccessType)right.AccessType,
                    AccessTypeRight = (AccessTypeRight)right.AccessTypeRight,
                    Id = right.Id
                });
            }

            return(model);
        }