Esempio n. 1
0
 public static AreaEntity ToBllArea(this DalArea dalArea)
 {
     return(new AreaEntity()
     {
         Id = dalArea.Id,
         Name = dalArea.Name
     });
 }
Esempio n. 2
0
 public static Area ToArea(this DalArea dalArea)
 {
     return(new Area()
     {
         Id = dalArea.Id,
         Name = dalArea.Name
     });
 }
        public void Delete(DalArea e)
        {
            var area = _context.Set <Area>().SingleOrDefault(a => a.Id == e.Id);

            if (area != default(Area))
            {
                _context.Set <Area>().Remove(area);
            }
        }
        public void AddAreaToProfile(DalProfile dalProfile, DalArea dalArea)
        {
            var profile = dalProfile.ToProfile();
            var area    = dalArea.ToArea();

            if (profile.Areas.Contains(area))
            {
                return;
            }
            profile = _context.Set <Profile>().Local.FirstOrDefault(p => p.Id == profile.Id) ?? profile;
            area    = _context.Set <Area>().Local.FirstOrDefault(r => r.Id == area.Id) ?? area;

            _context.Set <Profile>().Attach(profile);
            _context.Set <Area>().Attach(area);

            _context.Entry(profile).Collection(x => x.Areas).Load();
            profile.Areas.Add(area);
        }
 public void Update(DalArea entity)
 {
     throw new NotImplementedException();
 }
 public void Create(DalArea e)
 {
     _context.Set <Area>().Add(e.ToArea());
 }