public void Save(AreaViewModel areaViewModel)
 {
     Area area = new Area(areaViewModel.Id)
     {
          Name=areaViewModel.Name,
          Description=areaViewModel.Description,
           region=_regionRepository.GetById(areaViewModel.RegionId)
     };
     _areaRepository.Save(area);
 }
 AreaViewModel Map(Area area)
 { 
 return new AreaViewModel 
 {
  Id=area.Id,
  Name=area.Name,
   Description=area.Description,
  isActive = area._Status == EntityStatus.Active ? true : false,
   RegionId=area.region.Id
 };
 }
 protected ValidationResultInfo Validate(Area area)
 {
     return _areaRepository.Validate(area);
 }
        protected Area Map(AreaImport areaImport)
        {
            var exists = Queryable.FirstOrDefault(_context.tblArea, p => p.Name == areaImport.Name);
            Guid id = exists != null ? exists.id : Guid.NewGuid();


            var regionId = Queryable.Where(_context.tblRegion, p => p.Name == areaImport.RegionCode).Select(p=>p.id).FirstOrDefault();
            var region = _regionRepository.GetById(regionId);
           
            var area = new Area(id);
            area.Name = areaImport.Name;
            area.Description = areaImport.Description;
            area.region = region;


            return area;

        }
 public AreaDTO Map(Area area)
 {
     if (area == null) return null;
     return Mapper.Map<Area, AreaDTO>(area);
 }
Beispiel #6
0
 public static Area Map(this tblArea area)
 {
     Area retArea = new Area(area.id)
     {
         //_Status = region.Active.Value,
         Name = area.Name,
         Description = area.Description
     };
     retArea._SetDateCreated(area.IM_DateCreated);
     retArea._SetDateLastUpdated(area.IM_DateLastUpdated);
     retArea._SetStatus((EntityStatus)area.IM_Status);
     
     return retArea;
 }
 protected Guid AddArea(string name, string desc, Guid reg)
 {
     Area area = new Area(Guid.NewGuid())
     {
         Name = name,
         Description = desc,
         region = _regionRepository.GetById(reg)
     };
     area._SetStatus(EntityStatus.Active);
     return _areaRepository.Save(area);
 }