Ejemplo n.º 1
0
 public static Avatar AvatarToOrm(AvatarDal avatarDal)
 {
     return(new Avatar()
     {
         Id = avatarDal.Id,
         Image = avatarDal.Image,
     });
 }
Ejemplo n.º 2
0
        public AvatarBll GetById(int id)
        {
            if (id == 0)
            {
                throw new InvalidIdException();
            }
            AvatarDal avatar = repository.GetById(id);

            if (avatar == null)
            {
                return(null);
            }
            return(avatar.ToBll());
        }
Ejemplo n.º 3
0
        public void UpdateAvatar(AvatarBll avatar)
        {
            if (avatar == null)
            {
                throw new ArgumentNullException("avatar");
            }

            AvatarDal currentAvatar = avatar.ToDal();
            AvatarDal existedAvatar = repository.GetById(avatar.Id);

            if (existedAvatar == null)
            {
                throw new EntityNotFoundException("avatar", avatar.Id);
            }

            existedAvatar.Image = currentAvatar.Image;

            repository.Update(existedAvatar);
            uow.Commit();
        }
Ejemplo n.º 4
0
 public static AvatarBll ToBll(this AvatarDal avatarDal)
 {
     return(Mapper.Map <AvatarDal, AvatarBll>(avatarDal));
 }