Esempio n. 1
0
        private CommunitityDTO ToDTO(CommunitityEntity Communitity)
        {
            CommunitityDTO cDTO = new CommunitityDTO();

            cDTO.BuiltYear      = Communitity.BuiltYear;
            cDTO.Location       = Communitity.Location;
            cDTO.Name           = Communitity.Name;
            cDTO.RegionId       = Communitity.RegionId;
            cDTO.RegionName     = Communitity.RegionEntity.Name;
            cDTO.Traffic        = Communitity.Traffic;
            cDTO.Id             = Communitity.Id;
            cDTO.CreateDateTime = Communitity.CreateDateTime;
            return(cDTO);
        }
Esempio n. 2
0
        public long AddNewCommunitity(string name, long regionId, string location, string traffic, int?buildYear)
        {
            CommunitityEntity communitity = new CommunitityEntity();

            communitity.BuiltYear = buildYear;
            communitity.Location  = location;
            communitity.Name      = name;
            communitity.RegionId  = regionId;
            communitity.Traffic   = traffic;
            using (ZSZDbContext ctx = new ZSZDbContext())
            {
                ctx.Communitities.Add(communitity);
                ctx.SaveChanges();
                return(communitity.Id);
            }
        }