public static Avatar AvatarToOrm(AvatarDal avatarDal) { return(new Avatar() { Id = avatarDal.Id, Image = avatarDal.Image, }); }
public AvatarBll GetById(int id) { if (id == 0) { throw new InvalidIdException(); } AvatarDal avatar = repository.GetById(id); if (avatar == null) { return(null); } return(avatar.ToBll()); }
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(); }
public static AvatarBll ToBll(this AvatarDal avatarDal) { return(Mapper.Map <AvatarDal, AvatarBll>(avatarDal)); }